Why did Chinese people have more than one name in ancient times?
In ancient China, people's names had three parts, their family name, given name and courtesy name. Take famous poet Li Bai for example. His family name, which came from his father's name, was Li. His given name was Bai, and his courtesy name was Taibai.
People used their given names when they were among family members. But in social life, they called each other by their courtesy names to show respect. This was mostly done among people of similar age. If you were talking about yourself, or if your elders were talking about you, the given name would be used instead of the courtesy name.
Men would get their courtesy names when they turned 20. It was a symbol of adulthood (成年礼). Women would get their courtesy names after getting married.
One's courtesy name often had something to do with one's given name. For example, the name of Mencius was Meng Ke. His courtesy name was Ziyu. Both Ke and Ziyu mean "carriage (马车)". Zhuge Liang's given name was Liang, which means "bright". His courtesy name was Kongming, which means "very bright".