Hungary’s behavior in WW2 is quite mixed. After Hitler conquered Poland, Hungary allowed fleeing Polish troops to safely enter Hungary.
Then Hungary entered into a period of cooperation with Nazi Germany. That was partially due to a desire to regain territories lost in WW1, as you noted.
But Hungary also wanted to avoid the fate of neighboring Yugoslavia. Play ball with Hitler, or get overrun and occupied.
They were occupied in 1944 by the Nazis. Hungary up to that point protected their Jewish population, but after the occupation almost all were shipped to Auschwitz.