Yes - downloading Xcode can be tough. I've had it "stall" many times and when I try again and it will finish - eventually.
One theory is the MacAppStore is messing up: If you are not running macOS Big Sur then you can only download up to Xcode 12.4 - but since you mentioned a blue ring, that suggests you are trying to download via the MAS which I don't think will easily offer you anything but the latest. A great site to keep track of this is on https://xcodereleases.com. Older releases of Xcode can be found here: https://developer.apple.com/download/more/?=xcode I think this requires a paid dev account.
Another theory is that the space left number is approximated by temporary usage and you really did run out of space for some stage of the download. Offline TM backups and things can take away space temporarily. I think there are stages of the download where it expands the download file and authenticates the release.
I've seen interrupted internet access stall Xcode downloads.
Really this is a constant battle - I'd love to hear more discussion of how others deal with this.