The ISO of a film roll indicates how sensitive that whole film roll is to light. That’s a chemical property of the film roll, which you cannot change shot by shot.
The ISO “setting” on your camera does not actually set the ISO of your film, as that is physically impossible. It does tell (the light meter of) the camera what the sensitivity is of the film you’re currently using. You are supposed to set it to the ISO value of your film.
In P-mode (Program mode) (and other “automatic” modes like Av and Tv), the camera uses the ISO information, to set the aperture and shutter speed for you.
It measures the light, reads the ISO you’ve set and then uses a combination of rules (these differ per camera brand) to choose a certain aperture and shutter speed.
In these earlier questions you can learn more about the relationship of ISO, aperture and shutter:
When you are ready to explore more advanced film techniques, you could look into push/pull processing where you use the ISO setting to “fool” the camera and then compensate for it during the processing of your film for creative effect.
Note that, if you use a digital camera, you can set the ISO for every shot as then it’s not a chemical property of the sensor, but a digital value that tells the sensor how much it should amplify the signal it receives.