Hello diascd,
You mentioned "These photos are also in the iCloud" so it sounds like you're using the iCloud Photos syncing service. If that's the case, then the changes you make on one device will sync across devices.
Example:
Say you have the iCloud Photos syncing option turned on, on both your iPhone and Mac. If you were to delete a picture on your iPhone, that is going to sync through iCloud and also delete it on your Mac. Or vice versa, if you delete a picture on your Mac it will sync through iCloud and delete on your iPhone.
If you want to keep your Photo libraries individual to each device, then you'll want to make sure you turn off the iCloud Photos sync on your devices before you start deleting anything. This will ensure that the picture is deleted only from that specific device and doesn't affect the pictures you have on other devices.
You can turn the iCloud Photos sync off with these steps:
On your iPhone or iPad
1. Go to Settings, then tap your name.
2. Tap iCloud > Photos.
3. Deselect “Sync this [Device]” to turn off iCloud Photos.
On your Mac
1. Open the Photos app, then choose Photos > Settings or Photos > Preferences.
2. Click iCloud, then deselect iCloud Photos.
How to turn off iCloud Photos
Cheers!