It's not doing any sort of scanning of your photos while they're just sitting on your device. The CSAM scanning only occurs when uploading photos to iCloud, and only to the photos being uploaded.
Source (pdf): https://www.apple.com/child-safety/pdf/CSAM_Detection_Techni...