Can someone explain what happened here?

One of your images show a xdm greeter screen.

You didn't say what your release was, but the other image shows what looks like focal or 20.04 desktop.

Thus the install of xdm replaced the default gdm3 with your replacement display manager. You would have received a question that asked which DM (display manager) you wanted to use (given you'd installed a second DM), and it looks like you selected xdm - thus it's use.

You can use sudo dpkg-reconfigure xdm to be re-asked the question you were on install; allowing you to return to gdm3 as used DM.

FYI: sudo dpkg-reconfigure gdm3 would also ask the same question :) as it'll list your installed choices & ask you to pick to use.