See the article Get help with iCloud Photos - Apple Support
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, open the Photos app, then choose Photos > Settings or Photos > Preferences. Click iCloud, then deselect iCloud Photos.
- On your Apple TV 4K or Apple TV HD, 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 device, go to Settings > [your name] > iCloud > Photos and select Download and Keep Originals. On your Mac, open Photos, choose Photos > Settings or Photos > Preferences, then click iCloud, then select Download Originals to this Mac. Keep your device plugged in to power and connected to the internet. After your originals download, you can turn off iCloud Photos. You can also select the photos and videos that you want to download from iCloud.com.
Before you turn off iCloud Photos, you might want to make a copy of your photos and videos.