Star Trek consistently takes a humanist approach to science fiction. There are a multitude of species and worlds but the focus always stays with Starfleet and its largely human-crewed ships; advanced technology is certainly present and often plays a major role in the plot, but it’s a tool, a setting, more than it is the focus.
Take the android. In Star Trek’s version of Earth’s future timeline, humans don’t create the first android until 2330 when Dr. Soong creates Lore, Data, and his other prototypes. This is relatively late on the technology timeline—about 300 years after the invention of warp drive, and more than 200 years after invention of the transporter. Compare this to Isaac Asimov’s future Earth in I, Robot, where robots are common in the 21st century. Or Do Android Dream of Electric Sheep/Blade Runner, where there are not only androids in the early 21st century, but models so sophisticated they can pass as humans. The android or robot is a common character in sci-fi worlds, but Star Trek downplays its role, choosing instead to keep the focus primarily on organic life forms.
Even more telling is that most artificial lifeforms in the Star Trek universe want nothing more than to be human. That’s Data’s driving mission throughout TNG. His brother, Lore, is an exception; he thinks androids and other artificial lifeforms are superior and tries to use some renegade Borg to overthrow humanity (TNG Ep. 6.26, “Descent”). But Lore is clearly established to be the villain in this saga, getting Data to join in on this plan only by shutting down his ethical subroutines. Data and Lore are more advanced than humans in many ways. They’re stronger and more precise, possess vastly more knowledge and better computational skills, and are more durable—theoretically immortal. The idea that such a creature would long to be human reinforces the idea that the intangible human spirit is more valuable than strength or intellect.
The Borg convey a similar message. At the most basic level, they’re technologically-enhanced biological organisms. These enhancements make their perceived advantages and short-fallings similar to those of an android, though the hive mind aspect also means they lack individuality—another quality valued by humans. Whenever a Borg is given its individuality back, it gladly gives up the strength and protection of the collective in order to be its own entity. This is seen in both Hugh (first introduced in TNG Ep. 5.23 “I Borg”) and the recurring Voyager character Seven of Nine, who—like Data—spends most of her series on a quest to discover her humanity.
Where Star Trek deals most uniquely with the idea of artificial intelligence, though, is in the realm of the hologram. Whereas both androids and Borg have corporeal forms, a hologram is nothing more than a projection of light waves. An android still exists when you turn him off; a hologram ceases to exist when you end its program. A self-aware hologram that’s on a quest to become more human faces an entirely different struggle than that of an android. The hologram has the intangible—the personality, the emotions, the individuality. What it lacks is physicality.
The nature of holograms changes a lot from 2364-2378 (the timespan collectively covered by TNG, DS9, and Voyager) and there is, fittingly enough, one self-aware hologram on each of these three series. TNG gives us Professor Moriarty—a program of the Sherlock Holmes character who is accidentally made sentient when Geordi asks the computer to create a character capable of outwitting Data (Ep. 2.03 “Elementary, Dear Data”). Like the character he was created from, Moriarty ends up taking the role of genius antagonist, both in this first appearance and when he’s accidentally reactivated four years later (Ep. 6,12 “Ship in a Bottle”) though his devious plots have an understandable goal: he wishes to be able to leave the holodeck and live a normal, human life. Though the Enterprise crew experiments with using the transporter to give him a corporeal form, their efforts are ultimately unsuccessful; they store his program and promise to work on technology that would allow him to exist outside the holodeck.
Considering how easy it was to create Moriarty completely by accident, it’s I suppose not surprising that sentient (or at least self-aware) hologram programs become seemingly widely available by the 2370s. It’s not clear whether Moriarty’s accidental creation led to these developments or whether they were in the works before. In 2373, Dr. Bashir buys a program for a self-aware hologram named Vic Fontaine, a 1960s era jazz singer program that also serves as a kind of counselor for the crew aboard DS9 through the toughest parts of the Dominion War. Unlike Moriarty, Vic seems relatively content to remain within the constraints of the holodeck (though the DS9 crew does keep his program turned on more than normal so he can “live” normal days). Even so, Vic continues the show’s trend of having AI admire humanity. At one point, the Ferengi character Nog is traumatized by a battle injury and goes to live with Vic on the holodeck while he recovers. Vic’s role in this scenario is to coax Nog back out into the real world and convince him that the holodeck is nothing more than a fantasy. Vic recognizes the constraints of his environment and that he is, by extension, inherently lesser than a corporeal being.
When the USS Voyager embarks on its mission in 2371, they are equipped with a holographic emergency medical program (EMH), which they rely on exclusively after their medical staff is killed in the first episode. The Doctor is made in his creator’s image physically and without much in the way of personality. Though his program has both self-awareness and the ability to learn, he was intended for short-term use; he developed as much as he did only because of the extenuating circumstances of his ship. By 2373, he exceeds the memory capacity of his program, which was never intended to run long enough to form interpersonal relationships. The Enterprise crew finds a work-around that maintains the core of his personality rather than take the easier route of re-initializing his program, which would wipe out all his memories. In doing so, they acknowledge his accumulation of memories as a self. It’s later in that year he acquires his holo-emitter, allowing him to leave the confines of sick bay and the holodeck. With both his physical and psychological limitations exceeded, the Doctor officially becomes the first holographic projection that could arguably be called an individual.
Perhaps the ultimate message about humanity that can be discerned from Star Trek’s various plays with AI is that our flaws make us human. The Borg—the ultimate enemy—are on a quest for perfection. That perfection takes the best from various species and eliminates the rest, in the end serving to make them all the same. When individual drones are extracted from the collective, they become sympathetic. Lore also sees androids and Borg as more perfect than humans, that trait that differentiates him from his brother Data, who admires the aspects of humanity Lore views as flaws. Though Moriarty is placed in the role of villain, we nonetheless respect his motivation and see him as sympathetic because his goal is to become more like us. The Enterprise crew feels the same way, storing him so they can help him on his quest rather than deactivating him as they do with Lore. Ultimately, the primary function of the AI in Star Trek is to explore what humanity means, admirably serving as foils to the human characters, whatever the specifics of their creation.