So I had the same problem like you all. I wanted to install Xcode 14.3. I tried both from Appstore and online from developer.apple.com . I also got the error with not enough space. Here is the solution that I found online:
You have to run the following command in terminal to create a file with multiple GB in size:
mkfile -n [SIZE FOR EXAMPLE 20g] FILENAME
After you create this file you simply have to move it to the bin and than empty the bin. For me this worked if I tried to install Xcode after that. I don't know why because the article for it costs money. But you can read it up here:
https://medium.com/geekculture/installing-xcode-with-not-enough-disk-space-available-b96c8f17115b