As per this article Set up and use iCloud Photos - Apple Support
iCloud Photos automatically keeps every photo and video you take in iCloud, so you can access your library from any device, anytime you want. Any changes you make to your collection on one device, change on your other devices too. Your photos and videos stay organized into Moments, Collections, and Years. And all of your Memories and People are updated everywhere. That way you can quickly find the moment, family member, or friend you're looking for.
Your collection uploads to iCloud each time your device connects to Wi-Fi and your battery is charged. When you have iOS 11 or later, your library updates over cellular too. Depending on your Internet speed, the time it takes for you to see your photos and videos on all of your devices and iCloud.com might vary.

- Update your iPhone, iPad, or iPod touch to the latest iOS, your Mac to the latest macOS, and your Apple TV 4K and Apple TV (4th generation) to the latest tvOS.
- Set up iCloud on all of your devices.
- Make sure that you’re signed in to iCloud with the same Apple ID on all of your devices that you want to use with iCloud Photos.
- If you have a Windows PC, update to Windows 7 or later and download iCloud for Windows.

- On your iPhone, iPad, or iPod touch with iOS 10.3 or later, go to Settings > [your name] > iCloud > Photos, then turn on iCloud Photos.
- On your Mac with OS X 10.10.3 or later, go to System Preferences > iCloud. Click Options next to Photos, then select iCloud Photos.
- On Apple TV 4K and Apple TV (4th generation) with tvOS 9.2 or later, go to Settings > Accounts > iCloud > iCloud Photos.
According to this article Get help with iCloud Photos - Apple Support
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. You can also select the photos and videos that you want to download from iCloud.com.
Read this also System Photo Library overview for Photos on Mac - Apple Support