Bees and ants are true team players unlike other creatures who seek safety in numbers for selfish reasons, according to researchers.
Scientists from Edinburgh and Oxford Universities used mathematical models to study "swarm behaviour".
They found that bison or fish want to get to the centre of large groups to keep themselves safe from predators.
Ants and bees worked together as a single unit, and were prepared to die for the greater good of the colony.
The study's findings appear to echo the insect worlds portrayed in the animated films Antz and Bee Movie, in which the characters live in rigidly conformist societies.
In some co-operative groups of animals - known as superorganisms - members are closely related, and work together to ensure their shared genetic material is passed on, the researchers concluded.
In other groups they perform a policing role, for instance in honey bee hives where worker bees destroy any eggs not laid by the queen to ensure the queen's offspring survive.
Dr Andy Gardner, from the University of Edinburgh, said: "We often see animals appearing to move in unison, such as bison or fish.
"However, what looks like a team effort is in fact each animal jostling to get to the middle of the group to evade predators.
"By contrast, an ant nest or a beehive can behave as a united organism in its own right. In a beehive, the workers are happy to help the community, even to die, because the queen carries and passes on their genes.
"However, superorganisms are quite rare, and only exist when the internal conflict within a social group is suppressed - so we cannot use this term, for example, to describe human societies."
The findings, funded by the Royal Society, are published in the Journal of Evolutionary Biology.