Before the Han Dynasty, in the third century BC, Chinese civilization was centered in the Yellow River valley; further south, in the Yangtze region, were non-Chinese states that were coming more and more under Chinese influence, the easternmost of which, on the coast (approximately where Chekiang is now), was Yüeh. (That is the modern Mandarin version of the name, which at that period had a final -t preserved in Cantonese "Yuet" and Vietnamese "Viet.") As the Chinese of Ch'in (which unified the country) pushed south, the Yüeh ruling classes scattered further down the coast and founded a number of little kingdoms collectively known to the Chinese as the "hundred Yüeh," the largest of which, near modern Canton, was called Nan Yüeh or 'Southern Yüeh.' These kingdoms were briefly conquered by the Ch'in emperor, Ch'in Shih Huang Ti, but after his death Nan Yüeh became independent under a former Chinese general, Chao T'o (known in Vietnamese as Trieu Da), who not only resisted the new Han dynasty to the north but conquered the peoples to the south, including the ancestors of the modern Vietnamese. This is the vital moment in our story, because it gave the Vietnamese people the lasting memory of a state that had stood up against the colossus to the north, and the name of that state was Nan Yüeh.
During the second and first centuries BC Nan Yüeh came more and more under Chinese domination, and by AD 42 it was firmly incorporated into the Han empire. But although the other peoples of the region lost their languages and became Chinese (the strongly divergent southern forms of Chinese presumably reflecting the influence of those lost languages), the Vietnamese kept a sense of their own nationhood (and, crucially, preserved their own language) even as they assimilated all the trappings of Chinese culture: the characters, the art, the examination system, the chopsticks. When they briefly achieved independence in the sixth century, the rebel Ly Bi proclaimed himself the emperor of Nam Viet, the Vietnamese form of Nan Yüeh. When independence came for good in the tenth century, the new kingdom was called Annam, but centuries later the old name was revived in a new form; I'll let Keith Weller Taylor, the author of the excellent book The Birth of Vietnam, tell the story:
The modern name of Vietnam dates from 1803, when envoys from the new Nguyen dynasty went to Peking to establish diplomatic relations. They claimed the name Nam Viet (Nan Yüeh). But the Chinese objected to this invocation of Chao T'o's rebellious realm in antiquity and changed the name to Viet Nam. This Chinese adherence to the formalities of imperial theory was resented at the time, but in the twentieth century the name Vietnam has acquired general acceptance among the Vietnamese.If this has piqued anyone's interest, the Tuvy Asian Resource Center has a useful account of early Vietnamese history, and I heartily recommend the Keith Weller Taylor book cited above.