MacOS routinely eats 30-40 GB of HD space in Volumes/Preboot and "macOS Install Data" for god knows what. Plus even a bare bones XCode installation will cost around 20 GB, much more if you actually want to run your code on connected devices.
But of course saving disk space is not exactly #1 on Apple's priority list when the 512 GB and 1 TB disk upgrades sell at 80% margin.