iCloud Photos is a synchronization service. When you engage iCloud Photos on a device, then the Library on that device is kept exactly the same as the iCloud Photos Library. So, for instance, if you take a picture with your iPhone, it is added to the iPhone's Photos Library, copied to iCloud Photos Library, and then copied to the Photos Library on each of the other devices that you have connected. If you delete a picture on your Mac, then that picture is deleted at iCloud and on all the other devices.
So, as long as the Mac is connected to iCloud, it will have exactly the same pictures. That's what iCloud is for. If you want the Mac to have a different Photos Library, then you need to turn off iCloud in Mac Photos' Settings. Then pictures that you take with your phone will no longer be sent to your Mac, and edits you make on the Mac will no longer be copied to the phone. If you ever re-connect the Mac to iCloud, then all the pictures at iCloud.com will attempt to load on your Mac-- you would need to make sure you had room.
Another option for saving space on the Mac is to use Optimized Storage, turned on in the Mac's Photos' Settings. You can set this on any device, independent of the others. If you set a device to "Optimize Storage," then Photos may store only smaller images on the device and rely on iCloud to keep the full sized images. Having screen-sized images stored locally allows you to quickly scan through all your pictures while saving lots of storage space. And, if Optimize is chosen, and you want to Edit a picture, Photos will reach out to iCloud to get a full sized image for you to work on. Your optimized Library may take up less than 20% of the space of a fully downloaded Library.
Beware, though: backing up a Mac Photos Library with Optimize Storage only backs up smaller images, not the full sized originals. If you want to backup your Photos Library with an Optimized Mac, the this is a process you can use:
Backup iCloud Photos with an Optimized Mac - Apple Community