How and why did it happen, because uniting 2 powerful nations as one is pretty rare in history, did it happen because of dynasty or did Austrians make it happen by force? Sorry for my English
It wasn't Austria or Austrians, it was the Habsburg dynasty inheriting the throne of the Kingdom of Hungary.
The Habsburgs were rather good at marrying into / inheriting powerful nations and regions. Consider Spain. Consider the Low Countries.
Hungary was stuck between an expanding Ottoman Empire and what was called back then still the Holy German Roman Empire. Many nobles supported Ferdinand, as they saw him the only one able to stop the Ottoman conquest, utilizing the resources of the German Roman Empire for this. Others supported a Hungarian candidate, Szapolyai.
The story is a bit complicated after that. There was a legitimate claim and local support, but also revolutions defeated by force in 1711-13 and 1848-49, but again it is a bit complicated because in 1711 again some Hungarians were Habsburg loyalists ("labanc") and there were revolutions in 1848 all over the empire including Vienna, so you can as well cast it as a republicans vs. monarchist type of fight in one country, and not a fight between two nations. Finally the Ausgleich of 1867 created Austria-Hungary with a compromise.
But it was not fundamentally about two countries doing something with each other, but more like Habsburgs doing stuff with various countries, and some supported them some opposed.