Swarming is an inevitable part of the reproductive cycle in honey bees. Although honey bees reproduce through mating and egg-laying, swarming is how they create new colonies.
This means a new queen is needed for the colony expansion. One female will emerge to take the position of the queen and will stay in the original hive. The old queen and half of the entire population however, will go and find another suitable place to start anew.
These bees will assemble on a tree branch, the nooks and crannies of a building, or a fence post near the original hive. The multitude of bees in this manner is called a swarm.
After temporarily situating themselves, scouts are sent out to look for the perfect place to build their new hive. These scouts will fly in a particular radius until one of them finds a favorable place for a new hive like a hollow tree. They will report back to the swarm and then together, all of them will leave the swarming site to go to the new chosen hive.
There is no sensible way of totally accomplishing the prevention of swarming. However, swarms tend to be gentle and calm because the bees eat loads of honey before they go swarming