ISO controls the sensitivity of the camera. This means that it doesn’t control the amount of light entering the camera, but how the camera should interpret the light coming in.
A higher ISO means higher sensitivity, therefore a brighter image for the same amount of light captured. It’s useful to raise the ISO when there’s no other way to increase brightness (e.g. a slower shutter would add blur and wider aperture would decrease depth of field).
The increased sensitivity comes at the cost of higher noise, resulting in a grainy image. A grainy image is better than a dark image, so it works as a last resort.
Noise can be handled in post-processing, but in general it’s best to use the “base ISO” (the lowest available) whenever possible and control brightness via exposure.