The Kingdom of Hungary was part of the Austro-Hungarian Empire until 1918. After the war, with the Treaty of Trianon in 1920, Hungary was broken up (effective from 1921). The borders you know from maps today were determined then. Hungary lost 72% of its former territory. More than 3 million Hungarian nationals found themselves living in neighboring countries instead of Hungary. Families were torn apart, and many lost sight of relatives.
Countries with towns that used to belong to Hungary include Austria, Slovakia, Slovenia, Croatia, Serbia, Romania, and Ukraine – so basically all neighboring countries – and even Italy and Poland.