I'm guessing that by "iPhoto" you are meaning Photos for iOS? iPhoto is an app that was discontinued 10 years ago.
It's not totally clear what you've done. Is the following correct?
- You transferred pictures from the iPhone to the Mac
- These pictures are currently in Mac Photos
- You deleted these pictures from the phone after you loaded them onto the Mac
- You have not had iCloud Photos active on your phone or Mac
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.
In this case, when you connect your iPhone to iCloud, all the pictures currently on the iPhone will be copied to iCloud Photos, and then, when the Mac is connected, all those pictures will be copied to the Mac. Then all the pictures that are on the Mac will be copied to iCloud Photos, with iCloud doing its best to avoid duplicates. So the result will be a combination of all the pictures on all the machines connected to iCloud Photos. You need to be sure that both devices have enough storage space to hold all the pictures, with 10% of the storage still remaining free.
You can use Optimize Storage on the Mac, on your iPhone. 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 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. But an optimized Library may be kept larger than that if the extra storage space is not needed.
Beware, though: backing up a Mac Photos Library with Optimize Storage only backs up smaller images. If you want to keep a true backup on an external disk for safe keeping, you need to have Download Originals checked.
You can back up an Optimized Library to an external drive like this:
Backup iCloud Photos with an Optimized Mac - Apple Community