名 = 夕 (evening / dusk) + 口 (mouth). In the dark of evening you can't see who's coming, so you call out with your MOUTH to say your NAME. A beautiful little story of how naming began — identity announced in the dark.
名字 means 'name' (名 given name + 字 a courtesy character). 名 also means 'fame' or 'famous': 有名 means 'well-known' (literally 'to have a name'). A 名人 is a celebrity. In China, your 名 traditionally came after your family name, never before.
In the evening (夕) you call out with your mouth (口) to give your NAME.
有名 ('to have a name') means famous. In Chinese culture, your name was your reputation — to 'have a name' was to be known and respected.