Source: Windows Central
When upgrading to a new version of Windows 10 (for example, the May 2021 Update), the installation process makes a backup of the previous setup to undo the changes in the event of a compatibility problem or critical error moving to the new version.
The only caveat with this safety mechanism is that even after the upgrade is completed successfully, the files will be kept, and they can take a large amount of storage in the "Windows.old" folder. Removing the previous installation files can help reclaim around 20GB of space, which can be significant for laptops with limited capacity.