The facility was host some of the greatest minds of the 23rd century, including Heidegger, Davro, Quayle and Holder. They were experimenting in collective intelligence when Legion was created as the product of that research. When composed of those great minds, the Gestalt Entity was one of the most intelligent sentient beings in the universe, and repleted the facility with artistic masterpieces and advanced inventions, the most notable of which was the "hard-light", or "solid", hologram.
Eventually, his creators died of old age, and Legion became a formless entity. Three million years later, the boys from the Dwarf were ensnared by the malfunctioning station guidance beam designed to help docking supply ships, pulling in Starbug on auto-pilot. Legion rematerialized, with elements of all the Dwarfers in his being, and intended to keep them hostage at the station so that he could exist again.
Legion recreated the crew's ideal quarters, and offered use of his Cyber Park, to entice them to stay non-violently; it didn't last. The Dwarfers found a way of escaping the Station by knocking each other out, except Kryten, leaving Legion to become a doppelganger of Kryten and was then forced to help them escape another of Legion's inventions, the Star Drive.
Before they left, Legion said that returning to non-existence would be a promotion after having a glimpse into the minds of the Dwarfers. (RD: Legion)