Darr's solution worked for me too. Killing the network connection and going to the cable fixed it for me. I think the reason it freezes every five min or so and spins the beachball for several minutes then repeats over and over is because it might be having an intermittent network issue with the device.
Xcode 12.3 was working good and then my barely died while I was loading a build onto my networked iPhone. Before I found Darr's suggestion I tried everything: :clear derived data, create a new project, reboot, re-install Xcode... non of that made any difference.