Humans generalise. It's what we do.
If you chose to handle every single experience as an isolated event, you'd never go anywhere or do anything for constantly investigating options, exactly like how you'd never get out of your house if you had to check every room was empty before leaving - by the time you've checked the last one, someone could have entered the house and got into the first one again, so you have to start back at the beginning and check them all over again.
Stereotyping is a very useful, essential mechanism for bypassing all of that - when we meet a new situation, we compare it to situations we've experienced before, and this gives us a guide as to what this one is likely to be like. For example, "this room was empty and I closed the door. People don't generally break into second-story rooms in any given five-minute period, so it's safe to assume it's still empty and leave the house".
The problem comes when people assume that stereotypes are facts - stereotypes/generalisations only give good indications of probabilities, and as long as you're always aware of the possibility that this situation is an edge-case where the "general rule" doesn't apply, there's no harm in it.
In our touchy-feely, inclusive, non-discriminatory society it's become deeply un-trendy to stereotype or generalise. People feel that because stereotypes have been over-used, or used to excuse discrimination or bigotry, there must be something inherently wrong with stereotyping. This is itself stereotyping, and - in this case - it's wrong.
What people really disapprove of are:
- Unfair generalisations (although since stereotypes come from repeated observations, there are a lot less of them than you think)
- People mistaking statistical guidelines for hard facts.
However, as ever as a culture we err on the side of throwing the baby out with the bathwater, and conclude that because some people have tried to use stereotypes to justify bad actions in the past, there's something inherently wrong with the whole idea of stereotypes. That's not the case.