There is a pattern of blocks on the side of a 135 film cartridge that some cameras can "read" to determine the ISO of the film. The system is called DX encoding. It was introduced by Kodak in March 1983, so older cameras certainly won't have the feature.
Quoting Wikipedia...
The outside of film cartridges are marked with a DX Camera Auto
Sensing (CAS) code readable by many cameras. Cameras can then
automatically determine the film speed, number of exposures and
exposure tolerance.
The DX Camera Auto Sensing code takes the form of a grid of contact
points on the side of the metal cartridge surface that are either
conductive or non-conductive. Electrical contacts in the camera read
the bit pattern. Most cameras read only part of the code; typically,
only the film speed is read, and some cameras aimed at the consumer
market only read enough bits to tell apart the most common film
speeds. For example, 100, 200, 400, and 800 can be detected by reading
only S1 and S2 and ground.
As pointed out in a comment and explained on Wikipedia, the full DX Camera Auto Sensing system uses 5 bits of information, but even by checking only the first 2 bits, it's still possible to distinguish between ISO 100, 200, 400, and 800 film. Some camera manufacturers took advantage of this to keep production costs down, and so the implementation in lower-end cameras may not read the full pattern. If a DX-coded film of any other speed is inserted, the ISO determined by the camera will be incorrect.