Trelane was a puckish, childlike alien introduced to several USS Enterprise crewmembers in 2267. That year, the Enterprise was en route to the Beta VI colony to deliver supplies, when it encountered a previously unknown planet. This planet, Gothos, was the home (playplace, really) of the powerful alien Trelane.
Trelane first transported Sulu, and then Kirk, from the bridge of the starship to the fortified manor he had constructed on Gothos. The Enterprise assumed orbit and sent a landing party into what they expected would be hostile conditions. Instead, they encountered an Earth-like oasis. There, the landing party discovered Trelane's home, and within it, the two missing officers – and Trelane himself.
Trelane, referring to himself as a retired general and being willing to accept the title "Squire," wore a blue tailcoat over a white frilled shirt and green riding pants with black boots. These clothes, along with his foppish mannerisms, were intended to suggest what he believed conditions on Earth to be at the time. In fact, he was viewing an image of Earth approximately four and a half centuries out of date, perhaps a consequence of the fact he was over nine hundred light years away.
The officers were found in a paralyzed state, but were quickly freed by Trelane, who did it with a wave of his hand. This was the first evidence of his super-humanoid abilities; there would be others. Trelane was initially quite friendly, but made it clear that his were the rules to be followed, and that the landing party would stay until he chose to let them leave. He made several attempts to ingratiate himself with the landing party, but as his customs were centuries out of date, his attempts served only to amuse the Enterprise crew.
Trelane explained himself and his surroundings by stating that he, as well as some others, had perfected a means by which matter could be converted into energy, and back into matter, at will. When Kirk compared this to the transporter, Trelane dismissed that as a crude example of an infinitely more sophisticated process, elaborating by saying that he was able to re-structure matter, essentially the way a replicator does, albeit far more rapidly. In addition, he was able to maintain a field around his planet (or at least in the oasis) that blocked scanning and communications, and was able to confer skills onto others – he taught Uhura to play the harpsichord with a wave of his hand.
Unable to obtain a specific lock through Trelane's blocking field, Spock beamed up all lifeforms in a general radius, returning all Enterprise crew to the ship. Trelane did not beam up, suggesting that he was not alive, or at least, not the kind of life the Enterprise's instruments were designed to detect. Kirk returned to the bridge, ordering the ship to depart – only to find that Trelane had likewise boarded the ship. Within the minute, he had returned the entire bridge crew to his drawing room for a meal.
During the meal, McCoy noticed that the food and drink had no flavor, while Karl Jaeger commented that the fire burned brightly, but emitted no heat. These details, and Trelane's error in time, suggested that he was not infallible and that he knew of the Earth forms but none of the substance. Kirk and Spock further theorized that some external agency was actually responsible for most of his tricks. When Kirk noticed Trelane rarely strayed far from his large wall mirror, he formed a plan. Choosing to play Trelane's "field-of-honor" game, he tricked Trelane into an old-fashioned duel. Instead of shooting Trelane in the duel, Kirk shot the mirror – which exploded spectacularly. Deprived of his support mechanisms, Trelane was unable to prevent the Enterprise crew from departing, but swore they were all dead men, Captain Kirk especially. The ship departed quickly, but Trelane quickly proved to have other mediums of instrumentality at his command – these proved to be powerful enough to move his planet and intercept the Enterprise no matter what course it took to attempt to evade Gothos, convincing Kirk himself to return to Gothos for what might be a final confrontation.
Back on Gothos, Kirk saw that Trelane had altered the setting, so that he was now a judge determined to sentence Kirk for the crimes of treason against a superior authority, conspiracy, and the attempt to foment insurrection. But it was all too easy for him. Kirk seized on this, suggesting that what Trelane needed was a challenge. He talked Trelane into a sword fight. If Kirk won, Trelane would let the ship go; if Kirk lost, he would die.
Trelane hunted Kirk for a time, using his powers to evade Kirk's attacks and finally to trap Kirk in a cage. But even then, Kirk refused to cooperate – he seized Trelane's sword and broke it over his knee, an act which drove Trelane into a rage. Kirk realized something about Trelane then: that he had a lot to learn about winning and, in fact, as he said to Trelane's face, "a lot to learn about everything, haven't you?"
Just then, Trelane's parents, who were shown as two glowing indistinct green forms, appeared. Their discussion with Trelane confirmed Kirk's realization – that, for all his power, Trelane was little more than a spoiled child of his species who needed to be punished for effectively bullying lesser races; the reference to "a naughty child with a fully-loaded handgun in unsafed condition" proved to be especially relevant. Trelane's parents took him away, noting that they would not have allowed him to intercept the Enterprise had they realized how vulnerable humans were, and apologized to Kirk, promising to maintain his life-support conditions while he returned to his ship. But they would not answer his questions about Trelane, or themselves, beyond apologizing for Trelane's misbehavior and confessing that it had been their fault for having overindulged him. (TOS: "The Squire of Gothos")
"General Trelane, retired. At your service, sir."
"Oh, how marvelous! Devastating! Why this could kill millions!"
"Oh, such primitive fury! Why he's the very soul of sublime savagery!"
"Oh, the remarkable treachery of the human species."
"Und... Offizier Jaeger! Ein Deutsch Soldat, nein? Ein, zwei, drei, vier! Gehen wir mit dem Schießgewehr!" (Translation: "And...Officer Jaeger! A German Soldier, no? One, two, three, four! Let's go on the shot gun!") Jaeger, a geophysicist specializing in meteorology, was underwhelmed.
"It's my game and my rules! But, if you need to be persuaded..."
"But I don't wanna come in and I won't. I'm a general! And I won't listen to ya!"
Despite the power at his disposal, Trelane made rather significant mistakes, which suggested either great immaturity or a relatively poor or basic education. This is consistent with his parents's references to him as a child. The vast powers at his disposal were therefore likely to be insignificant compared to what adults of his species could accomplish; his instruments, and even his planet of Gothos, were little more than toys by their standards.
It was never made clear in the episode whether Trelane's power came from the machine, or if the machine was meant to focus natural power of his species. However, it seems more likely that it is the second option, as he was still able to wield at least some power shortly after Kirk destroyed the machine, and he later continued to use his power to the same level afterwards, although it is possible that in the time gap, he either replaced or repaired it.
Trelane makes an appearance in the CD-ROM game Star Trek: Judgment Rites, having pushed his interest forward to the time of World War I and calling himself the "Baron of Gothos." While the Enterprise is in search of several missing starships, he attacks in a Fokker DR1 triplane fighter, and when defeated, sends Kirk, Spock, and McCoy to a replica of a World War I-era German town named Gothos. Kirk and his party must move through the artificial town, populated by brainwashed crewmen from captured Federation vessels, in search of the "power objects" that give Trelane his abilities, including a soldier's locket, a clock in a small shop, a school chalkboard, and the triplane fighter. When they were destroyed, Kirk and his party faced Trelane himself.
Trelane is revealed to have collected the starships and mounted them in bottles above a fireplace. Depending on the course of action the player takes, either Kirk convinces Trelane that war is nothing that should be emulated romantically, or Trelane's babysitter will arrive and spirit him away.
In the Peter David novel Q-Squared, Trelane is revealed to be a member of the Q Continuum, with Q being assigned as his mentor. In the book, Trelane is able to tap into "The Heart of The Storm," the theoretical and literal center of the universe, where chaos exists; doing so gives Trelane more power than the entire Continuum, allowing him to close it off and play with the universe as he pleases. Trelane then manipulates three different tracks of the USS Enterprise-D timeline- including the canon timeline, the timeline of "Yesterday's Enterprise", and a timeline where Jack Crusher is alive and Captain of the Enterprise, among other differences-, with the ultimate goal of the experiment being the merging of all parallel timelines and the destruction of the multiverse order. Captain Picard, with the help of Q implied in the text to be Trelane's father, although Picard respects Q's desire not to discuss the matter in depth-, manages to stop Trelane, though the experience reduces Trelane to a speck of his former existence. (In an interview on the TNG Season 7 DVD, John de Lancie said he believed that Gene Roddenberry, whether consciously or subconsciously, was channeling Trelane when he created Q.)
Trelane also appears in the 1993 DC comic book "A Little Man-to-Man Talk", and the Marvel Comics Star Trek Unlimited 1998 issue, "An Infinite Jest", in which he and Q are playing a game with the two main Enterprise crews.