In the comic book
series version of the Transformers
mythos, Cybertron was a lifeless asteroid
near the beginning of time. The chaos god Unicron
and the light god Primus
battled between the real and ethereal planes. Primus was heavily weakened, and in a self-sacrificial effort, trapped his and Unicron's essences each within an asteroid. However, this action did not result in a stalemate. It was only a delay.
Unicron was able to manipulate the asteroid that bound him into a planet that could transform into a giant planet-eating biped that resembled its former self. Primus formed a planet that eventually spawned beings that would act as its line of defense. This planet would become Cybertron, and the beings would become Transformers.
Primus stayed asleep at the center of Cybertron. By sleeping, Unicron would not be able to locate Cybertron easily. Primus would awaken when the time was right and the Transformers could defend it. However, an altercation between the Decepticons and Autobots in the center of Cybertron accidentally woke up Primus, which sent Unicron heading its way prematurely.
Unicron, upon reaching Cybertron, started eating it (as any proper planet-eater would do). All Transformers set aside their differences and banded together to fight the new menace and many died. Optimus Prime, in a suicidal move, used the Creation Matrix to destroy Unicron. Although Cybertron was ravaged, the Matrix restored it to excellent condition in the series finale.