The phrase "six-year old" is a compound adjective, which modifies the noun "boy". As a rule, if you'll use a number and the noun you're counting as an adjective or modifier, it should have this format: "number (dash) singular form of noun". A similar example is "six-storey building", "six-storey" being the adjective, and "building" being the noun it modifies.
Regarding "He is six years old." , "old" is an adjective since it modifies "he" (it answers the question, 'what kind?'). Now, "six years" tells "to what extent" is the boy's oldness. Thus, "six years" modifies the adjective "old", making the phrase "six years" an adverb. Basically, adverbs don't follow the same form as a compound adjective involving a number. Therefore, it's correct form is "six years old".
There you go. I hope it makes sense.