Seems to be a fairly popular theme across a lot of ancient China, (Three Kingdom's era is where I noticed it most), but does anyone know where it comes form and why it survived so long? Also, why did it die out?
There are two different things you might be referring to. I'll try to address both.
One is the hào 號 which is more like a pen-name for artists or poets. I don't think that's exactly what you are referring to.
The other one, which I think is what you're talking about, is the zì 字. This is the more common one and is usually called a "style name" or "courtesy name". These actually had variable meanings throughout history, and the hào could also appear in the same way that the zì is described above.
The social system of East Asian countries within China's sphere of influence tended to have heavily stratified social structures, with age being a major contributing factor. This is based upon Confucian ideals but we don't need to get into that here.
The style name was something that people would get upon becoming an adult, around 20 years of age. It was given to you by your parents. Quoting from Chao's Chinese Terms of Address below. I've added bracketed terms to give the transcription in hanyu pinyin.
The choice of a courtesy name, made by one's parent or teacher or by oneself, is often based upon some relationship, semantic or historical, with one's formal name. In the case of monosyllabic formal names, an 'empty word' like jy [zhī 之], as a suffix, or ran [rán 然] '-ly' is often added to the formal name to make a courtesy name out of it. Alternatively, the prefix tzyy [zǐ 子] 'child, scholar, philosopher, master' may be used.
Much like today where you refer to people as your superior or subordinate, it wasn't considered respectful to call someone by their birth name (míng 名) if you aren't older than them. The style name was meant to be a sign of respect.
However the hào is self-given and is something your friends or people of your own generation might call you. This is also chosen a little earlier in life than the zì would be.
The main reason this fell out of practice in the 20th century is because people were attempting to modernise, and a big part of that was attempting to remove a lot of these kinds of stratifications. This came about after the May Fourth Movement, demonstrations on (surprise) May 4 in 1919. It was a significant popular push for political and cultural reform as well as greater nationalism in the modern sense.
The reason courtesy names survived so long until then is because respect based on age has been a highly important part of social interactions in eastern Asia, and in many regards this is still the case today. Courtesy names haven't survived, but a lot of other features of this kind of stratification still remain throughout eastern Asia.
Women may also would have courtesy names, but it was less common since they would be married by the time it would otherwise be given. In these cases they'd be referred to by their husband's surname, so Mrs Wāng had she married someone named Wāng, or Mrs. Lǐ had she married a Lǐ. This served the same societal function as the courtesy name.
(edited to add block quote)
Source: