Countless millennia ago, in another galaxy, a cataclysmic war erupted that threatened to destroy galactic civilization as the life-forms native to that galaxy knew it. The Doomsday Machine or "Planet Killer" was created presumably as a bluff much like the H-Bomb to get the opposing side to surrender. But apparently the enemies of its creators refused to take the threat seriously, forcing its creators to unleash the weapon. Unfortunately, the weapon was uncontrollable and destroyed all life in the galaxy from which it originated.
Centuries later, after having confronted and destroyed civilizations across many galaxies, the Doomsday Weapon arrived in the Alpha Quadrant where it encountered the USS Constellation, a Federation Constitution-class star ship captained by Commodore Matt Decker, but like the many so-called threats it had encountered before the Doomsday Weapon was a far superior being and smashed the Constellation with ease.
The destruction of the planets within the system where the Constellation had first encountered the weapons drew the attention of James T. Kirk and the crew of the USS Enterprise, one of the Constellation's sister ships, to the weapon. When the Doomsday Machine began moving towards the Rigel system, the most densely populated portion of the Alpha Quadrant, an epic battle against the seemingly invincible weapon ensued.
The Doomsday Machine was ultimately stopped by Kirk and Scotty when they rigged the Constellation's impulse engines to overload and then sent it into the weapon, detonating a 97.835 megaton fusion explosion within that essentially killed the weapon's A.I., leaving nothing but a dead husk behind. The Doomsday Machine's fate following its defeat was never revealed.