These words don't have meanings that are similar, but why do they look nearly identical? Is it just a coincidence?
Yes, this is a coincidence. Generally, if the modern shape is confusing, you need to go back further in time to look at characters' original shapes and purposes to make sense of what's going on. Also, the meaning noon for 「午」 is a phonetic loan; that is, the shape 「午」 represented a word that sounded similar to an unrelated existing word meaning noon, and the shape has nothing to do with the meaning noon.
「年」 originally depicted a person 「人」 carrying grain plants 「禾」 on their back, indicating the meaning harvest period > year; check out Is the character 年 (or its etymology) related to the mythical beast in Chinese mythology? for the glyph origins of 「年」.
Glyph origins of 「午」
「午」 originally depicted a large wooden pestle used to pound or de-husk grainy foods such as rice. The word that 「午」 originally represented is now written as 「杵」, formed by adding semantic 「木」 (wood), and 「午」 forms or formed parts of other characters such as 「舂」 (picture of two hands 「廾」 using a pestle 「午」 and mortar 「臼」 > to pound, grind) and 「御」 (originally a picture of a kneeling person 「卩」 operating a pestle 「午」).
As mentioned earlier, 「午」 is a phonetically borrowed character for the word noon, as pestle does not have anything to do with noon.
There is a peculiar pattern across several older characters: blobs on a vertical line tend to expand outwards into horizontal lines, and this is a simplistic description of what happened to the shape of 「午」 as well. You may check out the following glyph evolution tables for comparison:
I can give you a general explanation of why many characters in Chinese look similar, but it is out of my reach to shed light on the details of this specific example.
The general reason comes because most literate individuals of Mandarin Chinese know and use between 3,000 and 4,000 different characters, but all of these characters are built by combining only around 200 components known as radicals. The situation is even more extreme as the 10 most used radicals appear in 10,665 characters (or 23% of all the dictionary entries). Radicals often indicate the meaning of the character, known as the semantic compound, and / or the sound, known as the phonetic compound. In some cases, the original semantic or phonological connection has become obscure, even more as many characters have been modified and simplified over the years.
On practice, this means you will encounter many characters that look similar because they use the same radicals. The compositions of your example are (according to https://en.wiktionary.org):
- 午: 𠂉十 or 丿干.
- 年: 𠂉㐄 or 午 一丨 or 午丄.
Understanding the exact nature of the radicals might be difficult. In the wiktionary entries for these words you can find some explanations of their etymological origin. I suggest you look at them if you are interested.