This isn't specific to English, all languages name countries a local variant to some degree. Germany is Allemagne in French, Tyskland in Scandinavian languages, Nemecko in Czech and so on. Why these countries get their names in other languages is quite interesting and unique for each language. Deutsch comes from the old high Germanic word for folk, or domestic, diutisc. Germany or Germania (italian) is from the Roman or Gaul name of the tribes that lived east of the Rhine, stemming from the time of the Roman Empire. Allemagne comes from the name of the tribe that populated the Alsace area.
Almain, and "dutch" were used in English to refer to Germans before the first recorded use of the word German in English in the 1500s. It's a pretty fascinating area of study.
hi! There are famously several names for Germany, and the question comes up here fairly often, as with national exonyms in general. Check out these:
/r/AskHistorians FAQ: Why do countries have different names in other languages?
/r/Linguistics FAQ: Why are our names for countries so different from what the people call their own country?
an old one with more examples How did countries translate the names of other countries?
as an aside, there have been a couple of related posts for city names
In many cases English uses older names that were in use before the modern country was formed. Egypt, for example is from the Latin name for the place occupied by the country that calls itself Misr. Germany likewise.
Your examples of Austria and Spain are really the same names that have drifted only slightly from their endonyms.