Often it's a matter of economics and viewer psychology at the same time! An actor shines once in a role that resonates with audiences, and suddenly screenwriters are writing similar characters for them, directors cast them specifically for that type at auditions, and producers don't even want to hear about experiments. Meanwhile, viewers get used to seeing someone in a certain image and subconsciously expect them in similar roles. The result is that an actor basically plays the same part over and over again for years!
The most interesting thing is that even when an artist desperately wants to break free from this typecast and takes on a radically different role, they often lose their audience simply because viewers aren't ready to re-imagine them. They're more comfortable seeing "their" actor, they go online and write that they acted badly, that they're imitating some other performer. It's a vicious circle!
Practical advice - if you're an actor, try to break free not abruptly, but gradually. Play a role that differs from your typecast, but in a project where you don't need recognition at all - like voice acting for animation, a cameo in serious film where your character is insignificant. That way you'll slowly get the audience used to a different image without losing your main fanbase all at once. That's much more effective than trying to change your image in one leap!