The Polish word Niemcy is peculiar: the word "Slavs" literally means "word people" while "Germans" literally means "mute/unintelligable people". I.e. the word originally meant something like "anyone we don't understand" (similar to the Greek word "barbarian" - someone who says bar-bar, some gibberish). Apparently, at some point the most common type of an unintelligable person you'd meet was someone from a Germanic tribe, so the word began to mean "Germanic". A few centuries ago the word still meant "Germanic" in Russian, people used it to refer to the Dutch and Swedes as well. I can guess Germans have been the most common type of a Germanic person in the last few centuries so the word's meaning was narrowed again and now exclusively means "German".
Tyskland and Deutschland stem from the same root teud- "people, folk", so it's literally "land of the people". Interestingly, the word was borrowed into Slavic and now means "foreigner, stranger" (Russian "chuzhoy", Czech "cizinec"). In Russian a derivation "chush" also means "gibberish" (we've come a full circle).
Btw. most of the Slavs are in for big surprise where comes English word "slave" from.
1) teud- => t'ud'-, i.e. the diphong -eu- changed to -u- and palatalized -t-
2) t'ud'- => c'üdz'-, another round of palatalization, similar to how Latin -tio came to be pronounced as -tsio (Polish still has "cudzy")
3) c'üdz' => ci(d)z- , sound change ü => i is quite common across languages, for example Greek -y- => -i-
As for the meaning, the Proto-Slavic word first meant "(foreign) people" => Czech "foreigner", Russian "stranger"
This page has some references at the bottom:
https://en.m.wiktionary.org/wiki/Reconstruction:Proto-Slavic...
It turns out xenonym is a synonym of exonym.
This was the old Slavic distinction between people who they could understand, and people who they couldn't.