"We cook them a meal."
Translation:Wij koken hun een maaltijd.
Hen is used in conjunction with prepositions or when "them" is the direct object [the object which the verb is acting upon]. Hun is used for possessives and when 'them' is the indirect object [are affected by the verb but not the object the verb is acting upon]. Often when something is the indirect object they are receiving something.
So in the sentence "I give them the book" the book is the direct object, because the book is what is being given, and 'them' is the indirect object, as they are the recipients of the book. Likewise in this example "them" is not what is being cooked - the maaltijd is! So the maaltijd is the direct object, and 'them' is the indirect object, so we use hun. [Using hen would mean that 'them' is what is being cooked!]
Duolingo, I also want you to tell us the truth about "hun" and "hen"! Can we really trust your further grammar explanations?
Don't worry. Even dutch people say it often wrong. The good news: it is no longer classified as an error in Holland. Unfortunately, DL still marks it as a error. Only NEVER say: hun of hen hebben.... That's really a big mistake. You have to say: Zij (or ze) hebben.... And further .. the "theBibliothercary" explains it very well.