Ultimately bad temper is down to genetics, but seems to happen in two ways. Certain Queens pheromone can cause bees to become aggressive and vice versa,some queens pheromones can cause aggressive bees to become calm. These were experiments done where queens from hives where swapped to see affect on temperament.
However, the usual cause is genetics and swapping or changing queens will have little affect until all the aggressive bees have died out.
Of course other factors also play into this, it's not simple.....
For example going queenless can often cause clam colonies to become aggressive; something I found this morning in a placid hive which is now queenless.
Ham handled frames and banging will cause many bees to become aggressive.
And the worst case of all is usually leather gloves covered in old stings, this will set off even the most placid hive