The USS Enterprise, captained by James T. "Jim" Kirk (William Shatner), on a mission to be the first earth ship" to probe the edge of the (Milky Way) Galaxy (the nearest edge being less than ten thousand light years away), discovers that she is not the first Earth Ship to reach that edge of the galaxy; the flight data recorder of the SS Valient, missing for more than two centuries, is found actively transmitting a distress message much nearer to the edge of the Galaxy than any of the crew believe to be possible for such an early Earth vessel equipped only with impulse (sub-warp (sub-light-speed)) engines.
When they beam it aboard, and it begins to transmit its uncorrupted contents, Science Officer Spock (Leonard Nimoy) interpolates the data and reports that the Valient had been swept away by a magnetic space storm about half a light year beyond the edge of the Galaxy before it was finally thrown clear of the storm. During it's at-least six-month journey back into the galaxy (approximately ten-thousand year journey back to Earth), she encountered an unseen force of some kind, initally appearing to have killed seven crew members, until one of them appears to have recovered, at which point began repeated, urgent, requests of the ships computer for anything concerning ESP (Extra-Sensory Perception) in human beings, leading very shortly to the captain giving the order to destroy the ship.
Totally undaunted by the fact that the Enterprise had been scooped by the Valiant in being the first Earth Ship to reach the edge of the Galaxy, Kirk orders the Enterprise to investigate this phenomenon, which they soon find, just beyond the edge of the Galaxy, displayed on screen as a bright pink graphic, in spite of Spock's declaration that ship sensors were unable to detect it (for the lesser-imaginative of the TV audience, of course), but that the ship's deflectors were reacting to it anyway, which was how the crew knew something was was there.
For reasons that could only be called an attempt to succeed where the Valiant failed, Kirk orders Enterprise into the field of unknown cosmic force, subjecting his crew to a sort of collision yielding casualities similar to the Valiant's: eleven crewmen smitten, nine dead: the survivors being a very recent acquisition named Doctor Elizabeth Dehner (Sally Kellerman), a "psychiatrist" assigned to the Enterprise to observe crew member behavior under great amounts of stress, with at least some knowledge of ESP, and the other survivor being one of Kirk's oldest friends in the service, Lieutenant Commander Gary Mitchell (Gary Lockwood), who had upon at least one occasion nearly died by acting quickly enough to save Kirk's life.
In the aftermath of the collision, it was learned that only crew members with above-average ESP ratings were affected by the forcefield, and that Dehner and Mitchell were both highly-rated in ESP, and that Mitchell, the crewmember with the highest ESP rating of all, was affected dramatically enough that something weird had happened to his eyes.
While the rest of the crew begin frantically to effect repairs to the ship and to predict what could possibly happen thereafter to Enterprise bad enough to have caused the Valient's captain to order her destruction, Mitchell and his weirded-out eyes begin to display an uncharacteristic increase in mental capacity: reading and reading retention are increasing at an exponential rate, he can correctly sense anothers' presence without even looking, he can accurately diagnose engineering damage right there from his bed in Sick Bay, and his voice... there's something about his voice that can't help but to scare his old friend, and captain.
While contemplating what to do about Mitchell to prevent Enterprise from suffering a fate similar to Valient's, Spock opines that the best solution would be to kill Mitchell while they still have the chance, before he becomes too powerful and it takes destroying the Enterprise to remove a threat like Mitchell was clearly becoming, which is what Spock and Kirk both surmise occurred with the lone similar survivor on the Valient.
The only crew member seen to vocalize dissent to this plan of action, ironically, happens to be Dr. Dehner, whose entrance scene included an obvious insult in Mitchell's direction, who, otherwise, is obviously displayed as being a very respectable, thoughtful, and even caring crewmate, and leader. All the rest appear to be in reluctant favor of Mitchell being killed for the sake of the ship. Again, only Dehner, who originally showed open disgust of the guy, takes that reluctance to the level of open dissention to Spock's plan.
Even Mitchell, himself, when confronted by Kirk with the question of what Mitchell, himself, would do were he in Kirk's position, appears to read both Kirk's and Spock's mind, and declaring himself to side with Spock, declaring that only a fool would refuse to kill him while he still had the chance.
Pained to take such an extreme course of action against a dear, old friend, Kirk opts to keep Mitchell alive, but to remove Mitchell as a threat to the ship by abandoning him on the planet Delta Vega, the nearest planet at which Enterprise is likely to find the materials necessary to repair the ship.
By this time, Mitchell has begun to develop telekinesis, and to believe himself a god, and the others to be 'like insects'.
Forcibly removed from Enterprise, and held inside a force-shielded chamber, when Enterprise repairs are complete, Mitchell escapes his cell and defeats the entire remaining landing party, killing one, rendering all but one of the rest unconscious, and realizing that Dehner has begun to become as powerful in ESP as he.
Together, they survey the otherwise unoccupied planet as a potential new home to the new gods which they have become, which Mitchell demonstrates by creating various forms of vegetation entirely from the power of his mind.
When Kirk regains consciousness, he realizes that anyone with that kind of power was still a very big threat to the safety of his ship, even from the planet's surface, and he hunts Mitchell down, with the intent to finish what Spock had suggested.
First, however, he meets Dr. Dehner, whose eyes are now every bit as wierded out as Mitchell's, telling him that it only took a little longer for her to start acquiring the same effects of the force field as Mitchell. Kirk pleads for her to assist him in bringing Mitchell down, but she refuses, by then being so much more than Kirk and the rest of humanity could become in millions of years, and Mitchell being so much more greatly advanced than she.
When Kirk and Mitchell do meet again, it is way too late. Mitchell is not even perceptibly affected by Kirk's phaser, but with a whisk of his hands, swats the phaser out of Kirk's hands, and announces that he IS a god.
Then begins Kirk to argue with Mitchell on a pholosophical level, about such things as absolute power corrupting absolutely, which finally does appeal to Dehner's sense of compassionate morality, who effectively destroys herself in order to weaken Mitchell enough for Kirk to meet in hand-to-hand combat.
Even then, Kirk is no match for Mitchell, and, on the very brink of total disaster, Kirk displays his trademark ability to snatch victory out of the jaws of defeat.