When an iPhone and Mac are signed with same Apple ID and password on the same network and photos box is turned as on the photos will sync , if photos are deleted from iCloud.com they will get deleted from iPhone and Mac .
In Mac set up photo library and its preferences see the articles
Set up and use iCloud Photos - Apple Supportsupport.apple.com › en-in
Change preferences in Photos on Mac - Apple Supportsupport.apple.com › en-in › guide › photos › mac
System Photo Library overview for Photos on Mac - Apple ...support.apple.com › guide › photos › mac
When photos are hundred percent synced , sign out Apple ID from Mac .
Sign out of iCloud on your iPhone, iPad, iPod touch, Apple TV ...support.apple.com › en-in
And sign in with new Apple ID and password that is created with you in the past .
Sign in with your Apple ID - Apple Supportsupport.apple.com › en-in
Then share photos from iPhone to Mac .
Share iPhone photos with Shared Albums in iCloud - Apple Support
Subscribe to shared albums in Photos on Mac - Apple Supportsupport.apple.com › en-in › guide › photos › mac
The Apple ID and password are totally different in iphone and mac if you delete photos from mac or icloud the photos will be not deleted from iPhone .
The invitation has to be accepted to receive photos ( has to be subscribed ).
Your previous old photos are in primary icloud account and are not lost as they are saved on Mac .
Hence photos are in iPhone as well in Mac .
Now , you can delete desired photos from Mac Delete photos or recover deleted ones in Photos on Mac - Apple Support