Xcode and its simulators fill tens of gigabytes over time. Clean them when the disk is running low, or when a build fails for no clear reason (stale build products, broken package resolution). Everything below is rebuilt or re-downloaded when needed, except where a step says otherwise (archives, simulator data).
Work through it in order: set the folder variables, check the sizes, then delete only what is worth it. Run every step in the same Terminal window,