Ship was a sentient spacecraft.
In the far future, an Earth colony on the edge of the galaxy faced destruction. The colonists made an organic computer to store their minds, since their bodies were dying. They built a spacecraft to take the minds to a safer place. Some colonists refused to undergo the process. However, the computer decided that all the colonists must be saved, so it sent the Ants to gather the recalcitrant and add their minds to the gestalt.
After escaping, Ship fell through one of the space-time rifts created by Kadiatu Lethbridge-Stewart's primitive time machine. It was damaged, causing it to equate any sentient being with the original colonists, sending the Ants to gather and assimilate any that they encountered. Eventually, if Ship learned how to stabilise the rifts, it would make more and try to upload minds anywhere in space and time. The creation of so many rifts would cause irreparable damage to much of the universe.
Kadiatu tried to destroy Ship by giving it a computer virus, but it was able to counteract that attack. The Seventh Doctor then rigged Kadiatu's time vessel to implode when it was moved, hoping the Ants would take it back to Ship. Unfortunately, Monsieur Thierry moved it first and he was killed by the implosion. Ship then captured the Doctor and "installed" him so it could access his mind directly and time travel as it wished. This was part of his plan, though, to trick Ship into allowing him direct access to its nervous system. Once connected, he turned off the computer, killing it. (PROSE: Set Piece)