Normally, when you save a folder that has the same name and size as another one, the Mac operating system will always ask you if you'd like to replace the folder that already exists. According to your situation, you must have used 'Replace', so the folder labeled with the same name as your new folder is overwritten. That is what we call an overwritten file/replaced folder.
Don't worry! The overwritten folder will still store on your Mac's internal hard drive until new data is written in its place. But you can't find it from any location on your Mac using Spotlight because once it was replaced by a new folder, the operating system will automatically remove it to free up space. You can consider your overwritten folder was deleted from your Mac drive temporarily and it is possible to get it back.
If you have backed up your Mac with Time Machine or iCloud before, you can recover the overwritten folder using Time Machine or iCloud. But if you have no backups in hand, then the data recovery software should be your last option to retrieve your lost files.
iBoysoft Data Recovery for Mac is a professional data recovery software to recover replaced files on Mac. This powerful data recovery tool is compatible with Intel Macs and Apple Silicon Macs with M1 and M2 chips and also works on macOS 13/12/11/10.15/10.14/10.13/10.12 and OS X 10.11, which is also able to recover emptied Mac Trash.
To recover the replaced files/folders from Mac using iBoysoft Data Recovery for Mac, do the following:
Step 1: Free download, install, and launch iBoysoft Data Recovery for Mac on your Mac.
Step 2: Select Storage Device or Disk Image under Data Recovery.
Step 3: Select your macOS internal disk and click Search for Lost Data to start scanning.
Step 4: Once the scanning process is finished, you can filter these recoverable files by different categories and then preview the scanning results. Once you find the overwritten files/folders, select them and click "Recover" to retrieve them from the Mac disk. Rember to not store the recovered data in its original place to avoid data loss.