They seek to devour Transformers in order sustain themselves.
While communicating with the Creation Matrix, the Matrix showed Optimus Prime that the Transformers initially reproduced reproduced through budding. However, Prime closed the psychic link between him and the Matrix before the Matrix could show him that abusing the budding process resulted in the Swarm.
The Swarm later attacked the Esk clones on the planet Fara. The Autobots later discovered the remnants of a Swarm assault on the moon J'asik. While they examined the scene, the Swarm had moved on to the planet Karn, to feed on a team of Cybertronians led by Mindset. Upon devouring the Cybertronians, the Swarm learned of the Transformers.
Analyzing the Swarm remains on J'asik, Autobot scientists discovered that the Swarm's genetics were the same as the Transformers.
Later, the Swarm devoured the Cybertronian battalion Xerxes and learned of the battle going on at Earth, prompting the Swarm to head there.
Arriving on Earth, the Swarm attacked both the Autobot-Decepticon Alliance and the Cybertronian Empire. They devoured Jhiaxus and forced the rest of the Cybertronians to retreat. While several Transformers tried protecting themselves with Rheanimum, Optimus Prime instead allowed himself and the Matrix of Leadership to be consumed by Swarm, ultimately turning the Swarm into a force of creation instead of destruction. The Swarm then recreated Optimus Prime's body as a way of making amends and left.