The name for the nation, Slovenes, was mentioned by a protestant priest and author Primoz Trubar in 1550s, describing the nation that lived in several different lands of the A…ustrian Empire. The origin of this name is not exactly known to me, but two possible origins spring to mind. The word is deffinetly linked to the word Slavs (Or Slovani in Slovene language), which represent a group of nations. One possibility is that the nation was named thus because it was the Westernmost nation of the southern Slavic nations, and the neighbours just called them "Slavs". This idea might explain why the Slovaks in the nord have been named in the same way. (Slovaks and Slovenes in their respective native tongues both call themselves exactly the same - Slovenci) .
The other possible explanation is that the word "Slovo" in ancient Slavic meant "Word". The word Slav, and possibly Slovenian come out of this. People used this name for those people who could speak their "Word", their language. It is interesting that Slovenes as many other Slavic use a word "Nemci" for German people, the word in fact means "The mute ones", which indicates that they did not speak the same language. It must be stressed that the word "Nemci" is in no way insulting, it is the official word for Gemans still. .
The name Slovenia for the land where Slovenes live is derived from the name of the nation and it came much later. Slovenes in Austria lived in several different lands, Carniola, Styria, Istria, Gorizia and Carinthia. In 19th century, when awarenes of nationhood arised, authors started to use the word Slovenija to describe the entire territory where Slovenes live, thus uniting the nation under one banner. Officialy the word was first used in print by a Slovene poet Jovan Vesel Koseski. ( Full Answer )