Bee stings most commonly occur when a person unknowingly disturbs a nest. Generally, bees are passive and just want to be left alone. However, each bee has a specific role that they play and there are some bees in hives that are designated to protect the nest. These protector bees will fly out en mass and attack any perceived threat. Some bee species are particularly aggressive.
Bees are different than other stinging insects. They have a barbed stinger that causes it to become stuck in the skin of the person stung. This causes the stinger to rip out of the bee when it flies off, killing it. Wasps and hornets have smooth stinger that allow them to sting again and again.