Gothos was a iron-silica planet-sized body of a magnitude 1E located in a star desert in Quadrant 904. When the USS Enterprise was first intercepted by this body, it was eight days distant from Beta VI at warp factor three and Earth was nine hundred light years away. Gothos had no primary and a variable spatial position.
The normal surface of the planet had no detectable soil or vegetation, an extremely hot, toxic atmosphere swept by tornadic storms, and continuous volcanic action – deadly to terrestrial and most other sorts of life without oxygen and life support.
In reality, Gothos was artificially constructed by the entity Trelane sometime around 2267. Trelane manufactured the world, and various artifacts on it, for the purpose of interacting with individuals kidnapped from the Enterprise.
Upon beaming down to the surface, the landing party consisting of McCoy, Jaeger, and DeSalle discovered an oasis-like condition – flourishing vegetation, standard Earth atmosphere, and a large castle-like structure, all manufactured by Trelane.
Although most of Trelane's tricks were accomplished with the help of his mirror machine, a "medium of instrumentality," Spock theorized that the local conditions were maintained by a different machine – a machine too large to fit within Trelane's home. Evidently, this was true, since the atmospheric conditions persisted after Kirk destroyed the mirror machine.
Trelane was able to move Gothos at speeds fast enough to outpace the Enterprise's flight. The method used to accomplish this was not revealed, but the planet was sufficiently maneuverable to thwart standard evasive tactics. (TOS: "The Squire of Gothos")