See the article https://support.apple.com/en-in/HT204570
How do I turn off iCloud Photos on only one device?
You can turn off iCloud Photos on a single device when you follow these steps:
- On your iPhone, iPad, or iPod touch, go to Settings > [your name] > iCloud > Photos, then turn off iCloud Photos.*
- On your Mac, go to System Preferences > iCloud. Next to Photos, click Options, then deselect iCloud Photos.*
- On your Apple TV 4K or Apple TV (4th generation), go to Settings > Accounts > iCloud. Under Photos, press Select to turn off iCloud Photos.*
If you have Optimize Storage turned on, you might not have all of your original photos and videos on your device. To download the original photos and videos on your iOS device, go to Settings > [your name] > iCloud > Photos and select Download and Keep Originals. On your Mac, open Photos, choose Photos > Preferences, then select Download Originals to this Mac. Then you can turn off iCloud Photos.
Read this also https://support.apple.com/en-in/HT204247