The episode re-introduced Gates McFadden as Chief Medical Officer Beverly Crusher, who had been replaced for the second season by Katherine Pulaski played by Diana Muldaur. Also in this episode the ship's Chief Engineer, Geordi La Forge, was shown to have been recently promoted to a Lieutenant Commander and Klingon Chief of Security Worf was made a full Lieutenant. It also marked the first appearance of the redesigned two-piece Starfleet uniforms which would be used for the rest of the series.
USS Enterprise Captain Jean-Luc Picard notes in his Captain's Log that his ship has been assigned to a critical mission of astrophysical research in the Kavis Alpha binary star system. Eminent scientist and guest Dr. Paul Stubs will attempt to study the decay of Neutronium at relativistic speeds as it is expelled from a massive stellar explosion which is due to occur in a few hours.
In one of the ship's Medical Science labs, acting Ensign Wesley Crusher has fallen asleep and is called by ship's First Officer Commander William Riker to report to the bridge, much to Wesley's chagrin he is late on duty as Enterprise helmsman.
Once Wesley arrives at his post, Dr. Stubs observes to him that the binary system is very beautiful, adding that the explosions only occur every 196 years and are caused when one of the components of the binary, a neutron star, draws enough stellar material off its red giant companion to create an explosive build up. He also notes that the Kavis binary stars are the stellar equivalent to Earth's Old Faithful geyser since the cycles of both are so regular. To gather the required data, Stubs has constructed an instrumented probe which he calls the 'Egg', to be launched from an Enterprise Shuttle bay right before the explosion.
As the crew prepares for the launch the ship suddenly lurches out of control, throwing Stubs across the Bridge. Lt. Worf reports that they are heading right into the stream of stellar material being drawn from the red giant. Lt. Commander Geordi La Forge attempts to regain control of the ship and is finally able to get the impulse engines on manual control, stopping its movement. Stubs is taken to Sick bay and treated for minor injuries.
Beverly Crusher comes to see Picard in his ready room and asks him about Wesley, saying that since she returned from her tenure at Starfleet Medical she has felt disconnected from Wes. She questions Picard about how her son has acted while she's been away, and if Wesley has many friends or has been in love. Picard is unable to provide any answers. Crusher confides that she's concerned about her son, worried that he is being too serious, taking too much responsibility, acting like one of Picard's officers and not enough like a 17 year old, who should be having fun and getting into a little trouble.
Meanwhile, Stubs and Wesley go to the Shuttle bay to inspect the 'Egg' for possible damage. As they do so, Stubs, who sees Wes as a gifted peer, shares with him some of the difficulty Stubs suffered growing up as a 'wunderkind' (wonder child), where living up to his own perceived potential became one of his biggest challenges.
All at once the red alert klaxons go off. Up on the Bridge, Picard and Riker scan the viewscreen for the Borg vessel which Worf picked up on sensor scan, but the ship is nowhere to be found. Suddenly, the Enterprise once more seems to take on a mind of its own as the shields, impulse, and warp drives go offline, even the Bridge Turbolift doors malfunction, starting to open and close rapidly at random.
Picard calls a conference looking for an explanation and Stubs barges in, demanding to know if Picard has everything under control. When told that Geordi is attempting repairs and that the safety of the ship must come first, Stubs replies that he is ready to give his life for his research, and due to its vital nature, he hopes that Picard isn't merely "playing it safe". After the storms back out, Ship's Counselor Deanna Troi observes that Stubs has put his entire self worth on the line with his experiment, and is serious about being willing to die to complete it.
In the Engineering, Geordi and Wesley examine the computer core processor elements, Wesley hoping that the computer difficulties are caused by a simple mechanical problem, but La Forge observes that it looks like the individual parts are breaking down almost as if they are being taken apart.
With a horrible suspicion, Wes returns to the medical lab where he had fallen asleep earlier, and with a stricken look on his face scans an empty container. Later in Ten-Forward he puts out what he calls "traps" and tells Guinan that he might be responsible for the computer issues the Enterprise is having. He explains that he was working on his final project for advanced Genetics, the project involves Nanotechnology, for his research Wes was using some of the nanites from the Medical department's genetic supplies. Wes says he was attempting to ascertain if two nanites could interact and function in tandem to work together and combine their skills, increasing their usefulness. He further explains that while working on the miniature devices, he fell asleep and later found their container to be empty, he now fears that his theory may have tragically proven to be correct.
Picard notes in his Log that the computer core has clearly been tampered with, but without any discernible breach in ship's security. He ends the Log entry by noting that Geordi has gotten the engines back online, and hopefully the crew will be able to complete their mission. However, when the Shuttle bay tries once again to launch the probe, the bay doors won't respond, and the martial music of The Stars and Stripes Forever by John Phillip Sousa starts to play loudly on all shipwide communication channels. Picard decides to try and move the ship clear of the system, and makes their first priority discovering who or what is tampering with the computer system. Stubs is devastated that he might miss his chance to achieve a record setting breakthrough in his field, obviously a lifetime goal.
In the Medical lab Wes examines the traps he set, but finds nothing. Beverly comes in, and misinterpreting Wesley's anxiety for a continuing problem with communication between the two of them, expresses her motherly concern, and tries to get him to loosen up and open up to her. With difficulty Wes admits that he let two nanites escape and may be responsible for the ship's problems.
Calling a meeting of the senior staff, Crusher passes along Wesley's revelation. Wes demonstrates how the nanites are eating the ship's computer core linear memory crystal "like candy", as Riker puts it. Beverly informs the other officers that the nanites are replicating themselves and Operations Officer Lt. Commander Data theorizes that with each succeeding generation the tiny machines are enhancing their own design, resulting in an astonishing rate of evolution. Beverly opines that this may show that the nanites are now operating with a collective intelligence, working together and teaching each other new skills. Stubs scoff at this, saying that what they are seeing is merely the natural result of nanite reproduction, that it's impossible to have a civilization of "silicon chips". He suggests that the machines be exterminated like an infectious disease. Picard decides that even given the possibility of intelligence they should first try and remove the microscopic devices safely, saving more extreme measures for later.
As Geordi, Wes, and Data labor to remove the tiny machines from the computer core, Stubs joins them. He unexpectedly pulls a small Gamma emission device from his pocket and fires it into part of the computer core.
Shortly thereafter the air handling system on the Bridge goes awry, pumping out noxious Nitrogen Oxide gas at toxic levels. Riker swiftly overrides the Environmental Support controls and sets them to manual, which clears the air. Instantly the Bridge lights go dim and the ship starts shuddering and lurching. Worf and Data bring Stubs to the Bridge, telling Picard that Stubs sterilized the upper computer central core with Gamma radiation, killing all the nanites there. Stubs tells Picard that now there is no choice, as it has become a matter of survival - the nanites must be destroyed as they are simply "tiny machines with a screw loose". Data disagrees with this, saying that Stubb's own actions have provided evidence to the contrary, when attacked the nanites retaliated, which indicates intelligence. Picard orders Stubs confined to his quarters and asks Data to attempt to establish communication with the nanites. Data replies that he may be able to adapt the universal translator to do this and begins working on it.
Troi goes to see Stubb's in his quarters out of concern for his state of mind, but he refuses her help. After she leaves, the nanites attack him with electrical arcs, but he survives.
On the Bridge, as Picard prepares to have all the processor cores flooded with Gamma radiation and end the conflict with the nanites for good, Data announces that he has established contact with them. Wishing to negotiate a peace with the nanites in lieu of simply destroying them, Picard orders Stubs brought to the Bridge, intending to have him apologize to the nanites for his actions. Data offers himself as a conduit for communication with the nanites, telling Picard that the tiny devices can enter his body and inhabit his networks, taking over his systems and allowing face to face communication, although it will be risky to Data. Picard decides to take the chance as a gesture of trust.
The nanites inhabit Data, and speaking through him ask why the humans have attacked them. Picard replies that his people have peaceful intentions and want to coexist in harmony with the races they encounter. He adds that the actions of the nanites were misinterpreted as hostile by his crew. Stubs apologizes for what he did and says he only acted in a desire to preserve a lifetime of work. He asks for mercy from the nanites. Picard states that the hostilities between his crew and the nanites were due to mistakes made on both sides and that he desires an end to the conflict, adding that he will do all in his power to protect and assist the nanites. The nanites quicky and reasonably agree to make peace, although they state that they have evolved to a point where they no longer need any human assistance. Saying that the Enterprise has become too confining they add that they require relocation elsewhere.
A short time later Picard notes in his Log that the nanites have vacated Data, helped reconstruct the main computer core in time for the ship's mission to be completed, and have been relocated to planet Kavis Alpha IV, which thanks to Stubs' influence with the Federation has been designated as their new homeworld. The 'Egg' is finally successfully launched and when the much anticipated explosion occurs, works flawlessly, providing the data which Stubs and the Federation desired so greatly.
In 10-Forward, Beverly sees Wesley having fun in the company of a group of other young people, and feels relieved to see him acting more like a 'normal' teenager. However, she also notices how much the lovely young woman he is with seems enamored of him, and protectively asks Guinan what she knows about the girl.