You wrote "but when I open my library on my Mac, nothing is synced." What do you mean?
What are you seeing on your Mac? What is the status bar below "All Photos" showing? Check the status of your library in Photos for macOS - Apple Support
And please check your Photos Library at www.icloud.com in a web browser on your computer. There you can see,
- if your iPhone has uploaded the photos to icloud or not. If he photos have made it into iCloud but they are not yet on the Mac, there may be items in your library on your mac, that are damaged in someway and blocking the upload.
- But if the photos are not yet in iCloud, you will have to start the trouble shooting on your iPhone.
A common reason for a Mac not syncing with iCloud Photos are videos or images in a legacy format, that are no longer supported since macOS 10.15 Catalina. (About legacy media in iMovie for macOS - Apple Support)
Also referenced files (items that have not been copied into thePhotos Library but are referenced in the original location) can be blocking the syncing with iCloud.
Or simply keeping the Photos Library on a NAS or on an external drive with a file system format that is neither MacOS Extended (Journaled) or APFS. Or, running out of storage on your Mac or in iCloud.