If you are sharing the same AppleID and do not want the photos to sync across devices, disable iloud Photo Library on both devices: https://help.apple.com/iphone/12/#/iph961b96c4dhttps://help.apple.com/iphone/12/#/iph961b96c4d
Go to Settings > [your name] > iCloud > Photos, then turn off iCloud Photos.
If "Optimize Storage" has become enabled, disable it, before you turn off iCloud Photos and wait for the full resolution photos to download back.
When iCloud Photos has been disabled on both devices, you can delete the photos from each device, that you do not want on your device.
Do not delete any photos, while the iPhones are still syncing the photos.
You should also disable my Photo Stream, or all photos each of you is taking, will appear on each others device.
You may want to switch to Family sharing instead of sharing the AppleID. (Family purchases and payments - Apple Support)That will be more flexible and allow you to have separate iCloud Photo Libraries.