Image files are large, depending on the resolution and the format of the image files. For example, my Photos Library has a size 250GB for 50000 images and videos. I am not using "Optimize Mac Storage", because I want all my photos and videos also local on my Mac, not only in iCloud. Otherwise Time Machine would not be able to back up my photos, and I could not work with my photos, when I am away from the internet.
You can save some storage by syncing your Photos Library with iCloud photos and turning on "Optimize Mac Storage". Then iCloud Photos will remove some of the large original image files from your Mac and keep them only in iCloud to save storage on your Mac. But you cannot remove the library completely from the Mac. You will still need at least 10% to 20% of the full size of the iCloud Photos library locally on your mac, for the thumbnails of the optimized versions, so you can browse the library, also for the database files with the albums, adjustments, folders, metadata. And Photos will only optimize your photos when the storage is getting low, not needlessly, if you still have plenty of free storage - this is fully automatic. Otherwise you would have to download the same photos over and over again to work with your photos. You can force Photos to optimize the library immediately, if you are running out of storage and need more storage urgently: How to force Photos for Mac to Optimise the Storage Immediately
But then do not forget to make a backup of your photos. It is a lot of work for an optimized library: How to back up an optimized iCloud Photos Library - Apple Community