Austria-Hungary as such was formed in 1867 by Austro-Hungarian Compromise (Ausgleich). It established Hungarian Monarchy as a sovereign withing Austria-Hungary, on par with Austrian one. Only foreign policy, foreign trade, military and finances for those functions remained common, and of course Austrian emperor was at the same time also a Hungarian king. However, even if compromise comes after a period of neo-absolutism following 1848 revolutions, and than restoration of parliamentarian in 1860s, it reflects the real power relations within monarchy.
Austria-Hungary is often used popularly for the same state before 1867, but for clarity I will refer to it as Hapsburg Monarchy. How that came to be as a large, heterogeneous monarchy is for a quick reference perhaps best summed up in a maxim: Bella gerant alii, tu felix Austria nube (“Let others wage wars: you, fortunate Austria, marry”). Key perhaps is again Hungary, that accepted the Hapsburg dynasty 1527, while preserving its own status as a kingdom (given Hapsburg would be Hungarian king, as well as Austrian emperor and many, many other titles beside). At the time, Hungary was quite geographical reduced due to Ottoman conquests, but in following centuries it would be reconquered.
So far, I've mostly wrote about two major peoples, however Hapsburg Monarchy / Austria-Hungary was extremely heterogeneous. By the time national identities came to be, or became important, however you prefer to look at it, during 19th century Austrians/Germans made up just about half the population of Austrian part, and the same was with Hungarians in their part. Rest, in both parts, was made up by numerous smaller Slav peoples or now already nations: Czechs, Slovaks, Slovenes, Croats, Serbs, Poles, etc.
During most of 19th century most of those wanted some kind of political entity corresponding to given nation. Mostly, those request were not for independence, but for some sort of autonomous status within larger Hapsburg Monarchy. In as much as it was unpopular, it was mostly due to inability or unwillingness to provide that national aspirations. Dissolution or independence was however rarely the goal, and usually a marginal position in political life or each Slav nation. Only during First world war did ideas of dissolution get more currency, however even in 1918 it came as an unpleasant surprise to many.