Translation:If grandmother came home, grandfather would be happy.
The structure of the sentence is
[SUBCLAUSE] skulle farfar bli glad.
In the main clause, the verb is in the second place – the subclause takes up the first position.
In main clauses (except questions), the verb is in second place, but in subclauses, the subject goes before the verb, so in the subclause, we have Om farmor kom hem – subject before verb.
The main clause can stand on its own, while a subclause is dependent on the main clause.
So in this specific case, we have:
- "If grandmother came home" - can't stand on its own, definitely a subclause
- "grandfather would be happy" - would work perfectly fine as a sentence on its own
Note that it's enough that it can stand on its own grammatically - in this example, for instance, it does require more context to make sense in the scope of a conversation. :)
Sorry, I should have been clearer.
"home" in English can be used to mean "at home" occasionally, as in your example. Swedish cannot do this, though. The word hem has either the sense of "a home" or the directional sense of "to home".
In this specific case, English and Swedish work the same way, though - you can't say "come at home"; it's always "come home". And, similarly, hemma doesn't work for the same reason.