Are you using iCloud Photos on more than one device?
As long as more than one device is signed into iCloud Photos with the same Apple account for iCloud, the Photos Libraries are kept identical. You cannot have different sets of photos on synced devices. So you must not delete photos on one device, if you want to keep these photos on the other devices.
You have two options:
- Either sign out of iCloud Photos on the devices where you want delete photos and do no longer sync them with your other devices,
- Or save most of your photos on a computer and keep only a smaller set of photos in your iCloud Photos Library, only the photos you want to see on all your devices.
If you have a Mac as well, you can have several Photos Libraries on your Mac. Only one PhotosLibrary, your system Photos Library, can be in sync with iCloud. Keep the photos you want to see on your iPhone in your System Photos Library on your Mac and keep all other photos in an additional, local archive Photos Library.