On the holodeck, Lt. Commander Data plays a game of poker with holographic representations of Sir Isaac Newton, Albert Einstein, and Stephen Hawking (played by himself). Answering a question from Newton, Data explains that the game is an experiment for understanding "how three of history's greatest minds would interact" in such a setting. Just as Hawking wins another hand, a red alert is issued and Data suspends the program.
The Enterprise responds to a distress call from a Starfleet outpost. On arrival, they send down an away team consisting of Riker, Worf, Data and another security guard. They find the entire crew of the outpost dead. Suddenly they are attacked by a group of Borg. During the course of the fire fight, Riker observes that the Borg are not acting like the Borg they have encountered previously. For starters, each of them is armed with energy weapons and they refer to each other as individuals. In fact, these Borg appear to be fighting more like guerrilla warriors. While fighting a drone, Data feels an emotion — anger — resulting in his breaking the neck of the drone he was fighting.
At the same time, in orbit, an unidentified ship fires on the Enterprise and the crew returns fire. On the surface, during the firefight, one Borg begins talking to himself about the nature of the away team members, when he sees and mentions Data, he appears to signal a withdraw. The alien ship beams up the remaining Borg from the outpost and flees with the Enterprise in pursuit. Suddenly the ship enters some kind of vortex and disappears without a trace. Back on the outpost, Riker asks Data what happened, but Data cannot explain it; he just felt angry. Admiral Alynna Nechayev arrives to take command of the situation. She reprimands Picard for not destroying the Borg when he had the chance ("I, Borg") and orders him to do so if another opportunity should present itself. Meanwhile, Data is trying to understand what caused his behavior on the outpost. He tries to experience emotion again through simulations of the event, but does not succeed.
The Borg ship reappears and attacks another outpost. Again, the Enterprise is the nearest ship, which makes Picard suspicious, given that there are now several Starfleet vessels patrolling the area. The Borg ship reenters the vortex and disappears when the Enterprise intercepts; however, this time the Enterprise is caught in its wake and follows. Once on the other side, the Borg attack, beaming drones on to the bridge. After a brief fire fight, one drone is killed and another wounded, but the distraction allows the Borg ship to escape, which again is unusual Borg behavior in that they always reclaim their drones, whether alive or dead.
The crew discover that the vortex they entered is a form of conduit allowing them to travel from one star system to another almost instantaneously. However they have yet to work out how it is activated which means, for the moment, they are unable to return to Federation space. Data is sent to speak with the Borg whom the Enterprise has captured in an attempt to gather intelligence, but the drone is able to manipulate Data into releasing him, and escapes the ship in a shuttlecraft. Before the Enterprise can catch the shuttle it disappears into a conduit. However, the crew is able to learn how the conduits are activated and gives chase. They track the shuttlecraft to a planet. An away team finds no trace of Data or the Borg and something in the planet's atmosphere is blocking their sensors, so Picard decides to conduct a ground search utilising nearly the whole crew of the Enterprise. Only a skeleton crew remains on board under the command of Dr. Crusher.
During their search of the planet, Picard, Troi, a security officer and La Forge enter a building and are surrounded by Borg. Their leader, appearing on a platform, resembles Data but Troi recognizes that it is Data's brother Lore. Data also appears, announcing that "The sons of Soong have joined together, and together, we will destroy the Federation!"
Lore has discovered a way to give Data emotions and turned him against the Federation. Lore plans to lead these breakaway Borg to destroy all organic life; they believe that Lore and Data are perfect life forms. Picard, Troi, and La Forge are taken captive. Geordi's VISOR allows him to see a carrier wave being beamed from Lore to Data and they hypothesize that this is the source of Data's emotions and Lore's control over Data. For this reason Lore orders Geordi's VISOR removed. In orbit, the Borg ship is detected and Beverly orders the away teams on the planet to be beamed back aboard. However, there isn't enough time to get them all and 47 away team members still remain on the planet. Riker orders Dr. Crusher to leave the planet and come back only when it's safe to do so since the rogue Borg vessel has detected the Enterprise. Rather than leave the system, Beverly orders the crew to take the ship into the sun. Using the technology developed by Ferengi scientist Dr. Reyga, they modify the shields to allow them to get closer to the sun than the Borg can go. They use the ship's phasers to trigger an eruption on the sun's surface which engulfs the Borg ship, destroying it.
On the planet, Lore orders Data to perform an experiment on Geordi's brain – an irreversible procedure with a "60% chance" of being lethal. Geordi tries pleading with Data, who ignores him and continues setting up the process. In their prison cell, the away team constructs a device which they believe will reactivate Data's moral subroutines, in the hopes that he will question his unethical actions, as well as the intentions of Lore.
Meanwhile, Riker and Worf encounter Hugh, who tells them that Lore is the leader of this Borg group. He says that at one time Lore's help was necessary, but that he has since destroyed many Borg through brutal experimentation. Hugh's group are "rebel" Borg, wanting to remove Lore from power.
The away team manages to reactivate Data's ethical programming just as Data is about to start the irreversible part of the experiment. Geordi pleads with Data, asking him to check his conscience. Data falters, claims that there are anomalies in the experiment and postpones it.
Lore begins to doubt Data's devotion, and attempts to strengthen control by threatening to remove the emotions he has provided. Data appears to be subservient, but Lore remains suspicious, and orders Data to prove his loyalty by killing Picard. Data refuses, as the rebooting of his morality subroutines is complete. Two Borg seize Data and Lore is about to execute Data, when Riker and Worf arrive, accompanied by Hugh and some of his rebel Borg. A battle commences and in the ensuing confusion, Lore flees, pursued by Data. In their ensuing confrontation, Lore attempts to talk Data into escaping with him. Unswayed, Data shoots him with a phaser then deactivates him.
In the aftermath, Hugh becomes leader of the Borg group.
The Enterprise returns to Federation space. Data reports that Lore is to be disassembled permanently and he also intends to destroy the emotion chip, as it is "too dangerous", citing the harm he has inflicted under its influence. However Geordi intervenes, and advises him to keep the chip until he is ready. (The chip would eventually be implanted into Data during the course of the film Star Trek Generations.)
At a screening for the 1991 documentary film A Brief History of Time, which was based on the book of the same name by British theoretical physicist Stephen Hawking, Hawking was introduced to the audience by veteran Trek actor Leonard Nimoy. A Brief History executive producer Gordon Freedman told Nimoy that Hawking was an avid Star Trek fan. This led to an arranged visit by Hawking of the set of Star Trek: The Next Generation, which included an opportunity by Hawking to sit in the captain's chair. Freedman told the show's executive producer, Rick Berman, that Hawking would appear on the show if asked. Hawking accepted the ensuing offer, marking the first time a guest star played himself on an episode of any Star Trek series. After he was sent the script, he made some modifications to it, including improving a humorous line of dialogue to make it funnier, which Berman called "delightful".
Later, when actor Brent Spiner, who appeared in the scene with Hawking, first read the script, and saw that Hawking was a character in it, he imagined that he might be asked to play the scientist, as he had played multiple roles in episodes before. Spiner was excited, however, to learn that Hawking had agreed to play himself, leading Spiner to remark, "But I still think the guy cost me an Emmy". Filming of the scene drew a crowd of staffpersons, including those whom screenwriter Ronald D. Moore said were not working on the scene but pretended to have a work-related reason to be there. Between camera setups, Hawking was placed in a closet-sized room at his request, because such solitude allowed him to think without distractions. Berman related that of all the notable people he had met through the course of his career, including presidents and business magnates, the visitor who stood out above the rest was Hawking.
This episode is the only episode to have the episode title and opening credits listed during the cold open, before the title sequence. Normally, the episode title and all guest stars, producers/director are listed after the opening title sequence.