Viet is an ethnic term, of unknown linguistic origin, that dates from well before the common era. In its Chinese form it could mean either "beyond," i.e., the peoples beyond the boundary (outsiders), or "hatchet," perhaps referring to a farm implement common to the region. Nam is a Chinese word meaning "south." The early Chinese histories refer to a kingdom called Nam Viet, the southernmost of Viets; there were also eastern Viets and several other Viets.
After the Chinese conquest of the Viets in 111 BCE, various Chinese provincial names were used—the best known of which was Annam, meaning "pacified south." The term Viet was never used when the land was under Chinese administration, but was often chosen during periods of independence. The 11th century Dai Viet (Great Viet)—preceded by the 10th century Dai Co Viet—is the most important example.
The term tonkin dates from 1428, after the creation of the Lê dynasty. Tonkin simply means "eastern capital," and named not a region, but a city (roughly present-day Hanoi).
The term Vietnam dates from the early 19th century, when the Nguyen dynasty was founded. The Vietnamese government of this time was on very close terms with China, and the name was probably a compound derived from Dai Viet and Annam.
Like the Chinese before them, modern colonial powers also avoided the term Viet. Cochin China was used by the Portuguese to refer to the southern third of modern Vietnam, probably in order to distinguish it from the Cochin in India. The French kept this term for the south, adding Annam for the middle region, and Tonkin for the northern third. Thus, the term Viet today retains strong nationalistic, anti-foreign implications for its own people.