iCloud is a cloud storage service that helps you back up files on your Mac. When you turn on iCloud, it starts to sync files like photos on your Mac rather than moving them to the cloud storage. The photos and other files are still stored on your Mac. So, you find the photos take up space on your Mac even if you enabled iCloud.