Who says they all do? And there are reasons for their biting people. It can be out of self-defense or fear, or for defending someone or something they love. Dogs also bite when they're playing roughly.
Dogs don't know what it means to "be mean", their brains don't work that way. If they bite, there is ALWAYS a reason. Probably one of these:
The dog is scared or threatened, The dog is alpha and someone is invading their personal space or what they view as their belongings The dog is playing too aggressively The dog is hurt and doesn't want to be touched The dog is defending something they view as weak, such as an owner or puppy The dog has been improperly trained to be aggressive and is just doing what it was taught to do
There are probably other reasons, but you get the idea. They don't do it to be mean. There's always a reason.