Life is information embodied physically to take care of itself. Starting with the first vaguely reproducing whatever, all the way down to us DNA-encoded eukaryotes.
It should not be surprising if some aspects of biology are analogous to aspects of computing. In fact it isn't even an analogy.
All workers are also females, and they start out the same egg as a queen (fertilized). The workers choose to create a queen which has mature reproductive organs by what it feeds the larva. Specifically, NOT feeding it honey and pollen, typical worker larva food, and continuing a diet of royal jelly. Once the larva exceeds a certain age (typically 4-6 days), the path is set and cannot be changed.
Look up how you split a hive (basically you take some brood cells, and some food and a load of bees and put them in a new hive). The bees realise they are queenless and raise some brood to be queens. The first queen to emerge goes and kills the others being raised. Slightly strangely for a very organised species, the winner often isn't the best option and is usually the queen who emerges first. However the better queens are those that were fed royal jelly for longer.
Mating flights(s) then occur and then she is ready to go like crazy laying eggs, sometimes up to 2000 per day.
Agriculture: security research as applied to biology.