How does Craft know when to generate an Image Transform
Craft will make the image transform the first time the template is loaded in the browser and the getUrl() is called. The image will at first be saved in a temporary directory, then moved into a sub-directory in your assets folder. The subdirectory will be descriptively named according to the type of transform. For example, if my template calls for a 500 x 500 center-center crop at 75% quality, it will be saved in /uploads/_500x500_crop_center-center_75/img.jpg.

This works similarly when using a CDN like S3 or Google Cloud.