I wonder why a single city's (or country's) name is different in various languages. To me, city and country names are somewhat similar to a person's given name, and it doesn't seem right to call anyone with a translated version of their name. But why is it ok with cities and countries?
This is a wide-ranging question that perhaps permits many answers, e.g. of both linguistic and political kinds.
Sometimes renaming a town was a way of exerting a (outside) ruler's power: e.g. what was once Königsberg is now Kaliningrad, what was once Vindobona is now Wien (Vienna). Notice that it's not always straightforward to determine what the "right" name should be even from today's perspective.
The phenomenon also occurs within single languages: e.g. what was once Leningrad (and I should use the proper Russian name here, but don't read/speak the language) is now (again) St. Petersburg, and what is now Wolgograd was once Zarizyn then Stalingrad.
It would seem that there are also more innocent versions of the same phenomenon: for instance the English name Prague for Praha is perhaps to approximate faithfully the pronunciation of the city's German name Prag (and notice that Praha had a German-speaking majority well into the 19th century).
Personally, I try to avoid corrupting "correctly" formed city names when pronouncing them in English, our modern lingua franca: e.g. the normal English pronunciation of Montreal (in a way, even more so Montpelier) must be quite "horrid" to a native French speaker (and notice, these are quite clearly French names: mont = mountain); I try to do better (or "better") when situations permit. (Presumably this also affects native Spanish speakers vis-à-vis the English pronunciation of Los Angeles.)
BTW, how do you call Mt. Everest (aka Chomolungma aka 珠穆朗玛峰 ...) or Pope Francis (aka Franciscus aka Jorge Mario Bergoglio ...). The business of "canonical" names IMO seems quite hopeless (note to self: Wittgenstein I vs. II :), but of course one should be cognizant and respectful of places' (let alone the people's inhabiting them) histories and facets.
Each language has its own set of sounds and a writing system to accompany them. When words or names from a different language are introduced, they often have to be altered in order to fit into the existing set of sounds of the language. This happens even with personal names. The tennis star from Serbia is named Novak Đoković in his native Serbian, but in English and French his name is always represented as Djokovic. We've added an entire letter to his name. Why? Because that makes it easier for us to understand how to pronounce his name. If we spelled it as Dokovic, most of us would pronounce it completely wrong. This is the most common reason for the altering of names of places.
Sometimes there are places whose name is simply made up of words, as in "Netherlands" or "United States". In English, the meaning of "United States" is obvious, because it uses two English words. But to a speaker of a foreign language, it isn't. To keep the meaning, the individual words "United" and "States" are translated. So in French the country is called "États-Unis," in Italian "Stati Uniti" and so forth.
And then sometimes place-names just arose rather arbitrarily, because some name had to be given for them. The English name "Welsh" just comes from an old word meaning "foreigner," because to the Anglo-Saxons, that's all they needed to call those people. Germany is called that in English because of the Latin term "Germania," which refers to one particular tribe, while in French it's called "Allemagne," which refers to a different tribe (the Allemani) and in German itself it's called Deutschland, which roughly means "people's land". Obviously, calling it "people's land" in every language would be a bit confusing.
Q How did it happen that countries and cities got different names in different languages?
This can be re-phrased to "why are there (geographical) exonyms and how do they develop?"
And that is an interplay of languages, contact and isolation, historical contingency and clinging to traditions∞ or changing them.
An example for divergent developments in languages where an old exonym preserves the status at the poimnt of contact:
English exonyms for German cities are one example: Cologne from the older Latin Colonia Claudia Ara Agrippinensium (which is arguably more different) in modern German as Köln (locally: Kölle); and Munich for Munichen preserving the earliest German attestations somewhat closer of the city called München (locally: Minga!).
Sometimes, any such relation is no longer recognisable at all: should Georgia be properly called საქართველო – that is, I mean Sakartvelo?
Another example that shows how contacts between languages and geographies is analysed in Why are Germans referred to so differently in different languages?
This can also be visualised for intermediate language contacts, for example for German, Italian and Hungarian exonyms as well:
Finally a short hint at a most interesting phenomenon may be added: the mediation of exonyms by languages that dominate(d) the trade routes between the donor and the receiver language. This is most obvious with Swedish. It adopted many German exonyms for cities in Italy, e.g., Venedig [Venezia], Turin [Torino], Genua [Genova], Rom [Roma], Neapel [Napoli].
The examples of German, Hungarian and Italian exonyms show that the spatial spread of exonyms is largely influenced by historical as well as current political, cultural and economic relations. But other factors are also effective and distort this pattern partly. Most of them are linguistic like linguistic distance between languages, difficulty of pronunciation a.o. But also seemingly linguistic factors like the use of secondary and trade languages and language prestige hint at another important factor in the background: relations of political, economic and cultural domination and subordination.
–– Peter Jordan: "Exonyms as Indicators of Trans-National Spatial Relations", Review of Historical Geography and Toponomastics, vol. IV no. 7-8, 2009, pp. 7-16.
The more unfortunate aspect – as already alluded to in the present question – is then of course the construction of identity, local, in-group and out-group identity. Which can be inappropriately formulated as
Geographical names are such an important feature of geographical space that they may be seen as one of the foundations of every civilization. Through them, the land is »filled« with meanings. Spatially related identities can evolve only after a place has been given a name. Because geographical space is also a place of contact between different cultures, the same area may have different or overlapping geographical names. Through such contacts, the need for discussion and standardization of geographical names is quickly established. In international relations, standardization only became possible in the framework of the United Nations after the Second World War, when some common ground was established. Research on geographical names is based on official gazetteers or official lists of geographical names that have been established and mostly deal with the problems of exonyms and endonyms, as well as social aspects of geographical names, such as power relations. They refer to the positional power of societies and nations, can be used as referential power to attract people and build loyalty, and are related to expert power (Morgan 1986). Geographical names may thus be seen as one of the last nation-building aspects of geography. –– Drago Perko, Peter Jordan, Blaž Komac: "Exonyms and other Geographical Names", Acta geographica Slovenica, 57-1, 2017, 99–107. (DOI)
In case the basic stuff is still missing in the above:
Exonyms and endonyms can be names of places (toponym), ethnic groups (ethnonym), languages (glossonym), or individuals (personal name).
As pertains to geographical features, the United Nations Group of Experts on Geographical Names defines:
Endonym: Name of a geographical feature in an official or well-established language occurring in that area where the feature is located.
Exonym: Name used in a specific language for a geographical feature situated outside the area where that language is spoken, and differing in its form from the name used in an official or well-established language of that area where the geographical feature is located.
For example, India, China, Egypt, and Germany are the English-language exonyms corresponding to the endonyms Bharat, 中国 (Zhōngguó), مَصر (Masr), and Deutschland, respectively. Chinese, Persian, Turkish, Arabic, and German are exonyms in English for the languages that are endonymously known as "中文" ("Zhōngwén"), "فارسی" ("Fārsi"), "Türkçe", "العَرَبِيَّة" ("al-Arabiyyah"), and "Deutsch", respectively.
Exonyms may derive from different roots, as in the case of Germany for Deutschland, or they may be cognate words which have diverged in pronunciation or orthography, or they may be fully or partially translated (a calque) from the native language. For example, London (originally Latin Londinium) is known by the cognate exonyms Londres in Catalan, Filipino, French, Galician, Portuguese, and Spanish; Londino (Λονδίνο) in Greek; Londen in Dutch; Londra in Italian, Maltese, Romanian, Sardinian and Turkish; Londër in Albanian; Londýn in Czech and Slovak; Londyn in Polish; Lundúnir in Icelandic; Lontoo in Finnish. An example of a translated exonym is the French name Pays-Bas for the Netherlands, Nederland in Dutch, all of which mean "Low Countries".
Exonyms can also be divided into native and borrowed, i.e. from a third language. For example, Slovene uses the native exonyms Dunaj (Vienna) and Benetke (Venice), and the borrowed exonyms Kijev (Kiev) and Vilna (Vilnius), from Russian. A substantial proportion of English exonyms for places in continental Europe are borrowed (or adapted) from French; for example: Navarre (Spanish: Navarra/Nafarroa), Belgrade (Serbian: Beograd), Cologne (German: Köln), Munich (German: München), Prague (Czech: Praha), Rome (Italian: Roma), Naples (Italian: Napoli), and Florence (Italian: Firenze).
Tendencies in the development of exonyms
According to James A. Matisoff, who introduced the term "autonym" into linguistics, "Human nature being what it is, exonyms are liable to be pejorative rather than complimentary, especially where there is a real or fancied difference in cultural level between the ingroup and the outgroup." For example, Matisoff notes Khang "an opprobrious term indicating mixed race or parentage" is the Palaung name for Jingpo people and the Jingpo name for Chin people; both the Jingpo and Burmese use the Chinese word yeren 野人 (literally "wild men") "savage; rustic people" as the name for Lisu people.
Exonyms develop for places of significance for speakers of the language of the exonym. Consequently, many European capitals have English exonyms, e.g. Athens (Αθήνα/Athína), Belgrade (Београд/Beograd), Bucharest (Romanian: București), Brussels (Bruxelles, Brussel), Copenhagen (Danish: København), Lisbon (Portuguese: Lisboa), Moscow (Russian: Москва/Moskva), Prague (Praha), Rome (Roma), Vienna (Austrian German: Wien), and Warsaw (Polish: Warszawa), while for instance historically less prominent capitals Ljubljana and Zagreb do not (but do have exonyms in languages spoken nearby e.g. German: Laibach and Agram, though "Agram" is old fashioned and not used any more). Madrid, Berlin, Oslo, and Amsterdam, with identical names in most major European languages, are exceptions. Some European capitals might be considered partial exceptions in that whilst the spelling is the same across languages, the pronunciation can differ; thus Paris in English sees the 's' vocalised, whilst in Swedish Stockholm is pronounced with a more emphasised glottal stop which is missing in English. For places considered to be of lesser significance, attempts to reproduce local names have been made in English since the time of the Crusades. Livorno, to take an instance, was Leghorn because it was an Italian port essential to English merchants and, by the 18th century, to the British Navy; not far away, Rapallo, a minor port on the same sea, never received an exonym.
In earlier times, the name of the first tribe or village encountered became the exonym for the whole people beyond. Thus the Romans used the tribal names Graecus (Greek) and Germanus, the Russians used the village name of Chechen, medieval Europeans took the tribal name Tatar as emblematic for the whole Mongolic confederation (and then confused it with Tartarus, a word for Hell, to produce Tartar), and the Magyar invaders were equated with the 500-years-earlier Hunnish invaders in the same territory, and were called Hungarians.
The Germanic invaders of the Roman Empire applied the word "Walha" to foreigners they encountered and this evolved in West Germanic languages as a generic name for all non-Germanic speakers; thence, the names Wallachia, Vlachs, Wallonia, Walloons, Cornwall, Wales, Wallasey, Welche in Alsace-Lorraine, and even the Polish name for Italy, Włochy.
During the late 20th century the use of exonyms often became controversial. Groups often prefer that outsiders avoid exonyms where they have come to be used in a pejorative way: for example, Romani people often prefer that term to exonyms such as Gypsy (from Egypt), and the French term bohémien, bohème (from Bohemia). People may also avoid exonyms for reasons of historical sensitivity, as in the case of German names for Polish and Czech places that at one time had been ethnically or politically German (e.g. Danzig/Gdańsk and Karlsbad/Karlovy Vary), and Russian names for locations once under Russian control (e.g. Kiev/Kyiv).
In recent years, geographers have sought to reduce the use of exonyms to avoid this kind of problem. For example, it is now common for Spanish speakers to refer to the Turkish capital as Ankara rather than use the Spanish exonym Angora. According to the United Nations Statistics Division, "Time has, however, shown that initial ambitious attempts to rapidly decrease the number of exonyms were over-optimistic and not possible to realise in the intended way. The reason would appear to be that many exonyms have become common words in a language and can be seen as part of the language’s cultural heritage."
In some situations the use of exonyms can be preferred. For instance, for multilingual cities such as Brussels, which is known for its linguistic tensions between Dutch- and French-speakers, a neutral name may be preferred so as to not offend anyone. Thus an exonym such as Brussels in English could be used instead of favoring either one of the local names (Brussel in Dutch/Flemish and Bruxelles in French).
Other difficulties with endonyms have to do with pronunciation, spelling and word category. The endonym may include sounds and spellings that are highly unfamiliar to speakers of other languages, making appropriate usage difficult if not impossible for an outsider. Over the years, the endonym may have undergone phonetic changes, either in the original language or the borrowing language, thus changing an endonym into an exonym, as in the case of Paris, where the s was formerly pronounced in French. Another example is the endonym for the German city of Cologne, where the Latin original of Colonia has evolved into Köln in German, while the Italian and Spanish exonym Colonia closely reflects the Latin original. In some cases no standardized spelling is available either because the language itself is unwritten (even unanalyzed) or because there are competing non-standard spellings. Use of a misspelled endonym is perhaps more problematic than the respectful use of an existing exonym. Finally, an endonym may be a plural noun and may not naturally extend itself to adjectival usage in another language, like English, which has a propensity to use the adjectives for describing culture and language. The attempt to use the endonym thus has a bizarre-sounding result.
The names for a country and a people are often different terms, which is a complication for an outsider, with a noticeable examples being people from the Netherlands being called the Dutch by native English speakers and in Italian the use of tedesco for German and Germania for Germany.
As modern technology removes many of the barriers between peoples, it is increasingly becoming the case that younger people may be more familiar with an endonym than with its official exonym. For example, many Italian cities are now more famous for their football teams and Torino and Napoli are becoming more common than Turin and Naples.
One reason (and there are many other reasons, as pointed out by the other answers here) is that the same name can be pronounced differently in different languages, so what look like different names (e.g. Roma/Rome, Wien/Vienna) are really just different ways of pronouncing the same name.
To illustrate with a different set of examples, consider Korea, Japan, and Viet Nam, where Chinese characters were (or still are) used. Most place names, when written in Chinese characters, are the same across these four countries. However, when spoken, they could sound entirely different.
Example: In both Viet Nam and China, the country of Viet Nam is called the same thing in written Chinese characters (越南), whether in Viet Nam or China.
However, when spoken, the country of 越南 is pronounced as Viet Nam (in Viet Nam) and as Yue Nan (in Mandarin-speaking China).
Hence, now that Viet Nam has entirely abandoned the Chinese writing system, it may seem to outsiders that people in China bizarrely call Viet Nam by an entirely different name (viz. Yue Nan). But this is not at all the case. People in both China and Viet Nam are still referring to Viet Nam by the exact same name.
Explores would stumble upon a new town or city and ask the first person they saw what the name of the place was.
“You boy! With the pitchfork and leather trousers, come over here and tell me what this place is called!”
“um.. MÜNCHEN sir”
“MÜNCHEN! That’s a funny name, I’ll call it Munich, somebody write that down”