An ancient automated weapon that smashed planets for fuel, stopped by Kirk using the wrecked USS Constellation as a bomb.
The planet killer, also called the doomsday machine, was an immense automated weapon from outside the galaxy, shaped like a long cone with an open maw at one end. It broke planets apart with a powerful beam and consumed the rubble as fuel, and its hull of solid neutronium made it nearly impossible to damage.
The Enterprise found the wrecked USS Constellation in a system the machine had ravaged. Its commander, Commodore Matt Decker, had beamed his crew to a planet that the machine then destroyed. Decker was brought aboard the Enterprise and used his rank to take command while Kirk was on the Constellation, until Spock relieved him.
Decker then stole a shuttlecraft and flew it into the machine's maw, dying in the attempt. His death showed that an explosion inside the machine could hurt it, so Kirk rigged the Constellation's impulse engines to explode and sent the ship into the maw, beaming out at the last moment and destroying the machine.