First I should point out that while Duo is a good platform for practice, it is a bit weak when it comes to explaining the grammar, and you should probably find a basic grammar reference as a supplement. There are several good websites listed in our Learning resources FAQ. In general, don't try to learn from a single source, there is plenty of material out there, much of it free, and it helps to get multiple perspectives.
As mentioned above, you've run into German's (in)famous V2 word order. English has what it called SVO word order, meaning that subject, verb and object (almost) always occur in that order. So "I have a dog." and not "Have a dog I" or any of the other 4 permutations of "I", "have" and "a dog". The word order in German is more flexible with the main restriction being that the verb must be second. So "Ich habe einen Hund" and "Einen Hund habe ich" are both perfectly valid ways of conveying the same information. Since German inflections convey much more information than English inflections, you can change the word order and still be able to tell while role each element in the sentence is playing. For example because of the first person inflection "habe" rather than the third person "hat", we can tell that the subject is "ich". And because of the accusative inflection "einen" rather than "ein" we can tell that "einen Hund" is the (accusative) object. So with a fixed word order not a requirement, German uses word order to convey emphasis instead. I won't get into all the details of this here, but I liken a German sentence as like a little story with the highlights at the beginning and end so that people can remember them, while the relatively unimportant bits are relegated to the middle.
In your sentence, the phrase "wegen des Generals" is an adverbial phrase that tells you the cause of something. The speaker thinks this is the most important aspect of the sentence so it's placed first. Note that in English you can't do this unless you use a comma: "Because of the general, ... ." Because of the V2 rule, the verb "hatte" must come immediately after this phrase, and then you can put in the subject "der König" and the object "ein langes Leben". You could also put the subject first as in English: "Der König lebte wegen des Generals ein langes Leben." But that makes the sentence about the king and not about the general which the speaker wants to emphasize.
The V2 does take some getting used to for an English speaker, and it does make German sound rather "Yoda-ish" a first. (I think Yoda's actual rule would be VL, verb last, so not really the same as German at all.) Once you hear it enough times it sounds more natural.