Why does storing photos on iCloud also consume storage space on iPhone?
Even when your photos are stored in iCloud, the Photo app will still have a low resolution version of the image on the iPhone so that you can see what photos you have in the cloud. These images are quite small, but will still consume space on your iPhone. If you have selected 'optimise iPhone storage' the app will try to intelligently select photos the be available on your phone (possibly recent pictures, maybe ones you have looked at several times etc).
All these things will take some space ... but it will be a fraction of the space all of the full resolution pictures would take.