Your translation seems really useful in that it demonstrates how Italian is used and teaches us how to think about the way to form correct Italian sentences. In my opinion, literal translation should always be accepted, then a better more idiomatic phrase may be suggested within the current format of duolingo. Suggest you report it for the experts to have a think about.
For those who are still confused: "Quanti anni ha lui?" is the same as "'how old is he?" but could also mean "how many years does he have?" as in a disease-death sentence or something. In my opinion, however, "how old is he?" is a better translation because this is one of the most basic units, so you're supposed to be learning how to ask someone their age.
First, "How many years old's he" is also not a good answer in English. Please report it.
Second, in English you would usually just say "How old is he?" especially if you're measuring in years. Perhaps if you were measuring in days, you might say "How many days old is he?" Note the word order: "how many . . . old" has to go together.