You say you have "optimized storage enabled." Photos optimizes storage by keeping only smaller, screen sized images on your local hard drive, so they take up less space. When you choose "Edit" or "Print," the full sized images are quickly downloaded from iCloud-- usually so quickly that you can't tell that they weren't already there. It will keep full sized pictures on the Mac until space becomes limited and it needs the room.
iCloud is a syncing service-- it keeps all the same pictures on your Mac, your iPhone, and your iPad. If you take a picture on your phone, it is uploaded to iCloud and then downloaded to the Mac and iPad. If you delete a picture on your Mac, it is deleted on the other devices, too.
The Mac also keeps some extra files, like thumbnails and such, to speed things up.