He was cast as the Enterprise engineer for the second Star Trek pilot, "Where No Man Has Gone Before." He tried a variety of accents for the part, and decided to use a Scottish accent on the basis that he thought Scottish people make the best engineers.
As an engineer, Scott retains a reputation as a "miracle worker", with no known equal in the Star Trek universe. Throughout both the television and movie series, he is renowned for his technical skill, knowledge, determination and resolve. Scotty often acts as the solver of plot-critical situations, utilizing his expansive knowledge and ingenuity. His solutions are almost always creative and unconventional, dramatically effective, and crucial to the resolution of plot developments. The term 'Scotty factor' describes the practice of over-estimating how much time a project will require to complete by multiplying the actual estimate by a particular number. In strict terms it is a factor of four: the number cited by Kirk in the film Star Trek III: The Search for Spock.
Though his job is Chief Engineer of the Enterprise, Scotty is also an experienced command officer. Being Second Officer on the Enterprise (i.e. third-in-command), he takes acting command of the ship when Captain Kirk and Commander Spock are both unavailable. On one such occasion, when Kirk and Spock are trapped on an alien world, Scott uses the ship's power to shut down the planet's electrical grid for a few seconds, enabling Enterprise crewmen to rescue Kirk and Spock without violating the Prime Directive. Kirk places a commendation in Scott's personnel record for this innovative tactic (episode "Bread and Circuses").
Scott's personality is predominated by his dedication to his profession, which reaches the level of obsessiveness. His dedication is coupled with a deep sentimental attachment to the Enterprise. In the episode, "The Trouble with Tribbles," Kirk finds Scott reading engineering technical journals for relaxation. Kirk orders Scott to take shore leave at the space station in order to prevent trouble between the crew and the Klingons. Scott manages to do so, when a drunken Klingon tries to provoke a fight with Enterprise crewmen by insulting Captain Kirk (comparing him to a Denebian Slime Devil). Scott retains composure, ordering the crewmen to ignore the insults. It is not until a Klingon disparages the Enterprise by comparing it to a garbage scow that Scott loses his composure and begins brawling. Kirk confines Scott to quarters for the incident, which then gives Scotty an excuse to continue his journal reading.
Star Trek IV: The Voyage Home is the only Star Trek film to take place predominantly aboard a ship not named Enterprise. Nevertheless, Scotty is of enormous value throughout the film. The primary starship in the film is a Klingon Bird-of-Prey (taken from the Klingons during their defeat at the end of The Search For Spock). Scotty adapts himself to act as engineer aboard the alien vessel, in characteristic fashion. ("Damage control is easy. Reading Klingon, that's hard!") Scotty once again performs technological feats that allow victory for the protagonists. Following the crew's heroic acts during The Voyage Home, Scotty (and the rest of the crew, except for Kirk) is acquitted of any charges of prior selfish illegal acts. As The Voyage Home ends, Scotty and the rest of the crew of the martyred Enterprise -- the ship that was home to the crew from the time of the original series until its destruction in Star Trek III -- are introduced to their next assignment: serving under Kirk aboard the Enterprise's successor. Sulu expresses interest in serving aboard Excelsior, to which Scotty retorts, "Excelsior? Why in God's name would you want that bucket of bolts?!". Scotty is overjoyed to be shuttled along with the rest of the crew to the Enterprise's true successor, the second USS Enterprise, commonly referred to as the Enterprise-A. The Enterprise-A is revealed at the end of The Voyage Home, sporting the designation NCC-1701-A, a direct reference to the original Enterprise, which bore the designation NCC-1701 since its introduction in The Original Series. Enterprise-A resembles an updated version of the original Enterprise. The crew is overjoyed at the unveiling of the new Enterprise, with Kirk announcing, "My friends... We've come home."
Scotty serves aboard the Enterprise-A for the events of Star Trek V: The Final Frontier and Star Trek VI: The Undiscovered Country. Star Trek VI was, by design, an official sign-off for the Original Series cast, and is the last film to feature that cast in its entirety. However, Scotty appears in the seventh Star Trek film, Star Trek Generations. As Star Trek Generations opens, Scotty, along with Chekov, accompanies Kirk for the inauguration of the Enterprise-B, the third starship in Kirk and Scotty's era to bear the name Enterprise. Catastrophic events interrupt the ceremony, threatening the ship. Before Kirk sacrifices himself to save Enterprise-B, Scotty is the last person to see him before he disappears. It is Scotty who utters the final dialogue in the Original Series timeline: When the threat has passed, and Kirk has apparently been lost in the abyss, Scotty is asked by Chekov if anyone was in the room destroyed when the Nexus ripped open the bulkhead on Deck 15 where Kirk was. He stares into the void and somberly intones, "Aye."
In the 1987 movie Spaceballs, there is a parody of Scotty in the form of a character named Snotty, who is operating the transporter beam for President Skroob. The character speaks in a thick Scottish accent, wears a kilt and a Scottish-style hat, an obvious stereotype of Scottish attire. Instead of "Beam him up Scotty," Commanderette Zircon says "Snotty, beam him down."
In an unlikely reference, rap artists D4L have a song "Scotty" that uses his character and Star Trek in a bizarre description of otherworldly activity in Atlanta, Georgia.
The Planet Express crew meets up with most of the original Star Trek cast in an episode of Futurama. Scotty, however, is conspicuously absent and has been replaced by a short-lived character named "Welshy," who only speaks in Welsh. Reportedly, James Doohan was asked to be on the show and responded, "He-he-he, no."