If you used a Big Sur version of the Boot Camp Assistant to install Windows 10 on your Mac, then Windows 10 was installed to UEFI boot. This is based on the information given in following Apple websites.
Basically, you need to move the free space to occur before the Windows partition.
Note: The answer below applies to Macs which UEFI boot Windows. If you have an older Mac which legacy BIOS boots Windows, then you should should not use the answer below.
Your question is basically a duplicate of the question Missing around 20 GB of Space on MacBook, at least in terms of a solution.
To add the remaining free space back to the partition containing macOS, the partition containing Windows would have to be first moved to the end of the drive. There are third party tools that can move Windows partitions. However, not all are compatible with macOS. According to the other post, there are two possible compatible free tools available. These tools are outlined below.
GNOME Partition Editor (GParted). A Linux based bootable USB flash drive can be created containing this tool. After booting from the flash drive, the GParted tool can be used to move the Windows partition. If you build the bootable USB flash drive using the zip file downloaded from GParted, then both a keyboard and a mouse (or similar device) is required. One disadvantage is the keyboard and/or mouse may be need to be wired to use this tool. However, if you can boot from a Ubuntu installer flash drive, then only use of a mouse is required. One advantage is this tool does not have to be installed into Windows.
MiniTool Partition Wizard. This tool is installed into Windows. To move Windows, the Mac reboots and performs the move without user interaction. One advantage is any existing keyboard and mouse (or similar device) can be used. One disadvantage is this tool has to be installed in Windows and therefore will still exist on the drive after you are finished moving Windows.
Note: Before attempting to move the Windows partition, the Windows
chkdsk command should be applied to the NTFS volume in this partition. This can be accomplish by booting to Windows Recovery Environment (Windows RE) and entering the command below.
chkdsk c: /f
Once Windows is moved, the command below can be used to add the free space to the macOS partition (
diskutil apfs resizecontainer disk0s2 0