Year or years?
A five-year-old boy did do that. Not a five-years-old boy. The reason why the word year is not in the plural form is this: in this sentence year is not a noun. It is part of a grouping of three words that act like an adjective, or an “adjective phrase”.
You have probably seen other adjective phrases like:
…a two-hundred-year-old tree….
…the 10-kilometre-marathon….
…or a 20-minute-phone call….
There is a great explanation of this in the comments on the British Council’s Learn English site.
The reason why the phrase “five-year-old” is hyphenated in the first place and where the hyphens should go, could fill whole blog post by itself. In fact, at some point in the future, maybe it will.