I have a Mac Mini M1 with OSX Monterey. I just upgraded to 12.4. I'm currently using Xcode 13.4, but I've had this problem for a while now.
I have two Acer CB282K monitors. CB282K(2) is connected to the Mini's HDMI port and is configured as the main display. CB282K(1) is connected to a USB-C port via a USB-C / HDMI adapter and is configured as extended. Both monitors appear to be working perfectly.
If I hover my mouse over the green button at the top of the most windows, one of the pop up options is "move to CB282K(1)" or "move to CB282K(2)" depending on which monitor is currently displaying the window.
This works fine with most if not all of my programs (including Mail and Safari), but not with Xcode. When I first open any window, while the option is there, selecting it does not move the window to the other monitor. However, if I drag the window to the other window, the option works to move the window back and forth between the monitors. If I close the window and re-open it, it is again "locked" to the main display until I drag it.
I see this behavior with the first Xcode window I open, with a second Xcode window I open (say I want to view two projects at the same time), or with the Developer Help window.
I'm pretty sure that when I started with Xcode last summer, this feature worked, but it has stopped at some point in the past.