Dr. Paul Stubbs, an eminent scientist, has come aboard the U.S.S. Enterprise to study the explosion of a star in the Kavis Alpha Sector, which occurs only once every 196 years. As the crew prepares to launch Stubbs' research unit, the ship is suddenly drawn into the fiery path of the stellar matter. The U.S.S. Enterprise computers initially fail to respond to commands to stabilize, yet even after the ship is restored to normal, the computer reports no malfunction.
Faced with the potential breakdown of the ship's main computer, Picard warns Stubbs that the mission may have to be aborted. Stubbs, who has devoted his career to studying the once-in-a-lifetime event, is insistent that his project be completed at any cost. Meanwhile, Wesley Crusher is shaken by the realization that an experiment he had been working on may be at the root of the ship's trouble.
Knowing he must confide in someone, Wesley talks to his mother, Dr. Beverly Crusher, who has returned to the U.S.S. Enterprise after a year's service at Starfleet Medical. He explains that during a genetics experiment, he allowed two nanites, robots tiny enough to enter living cells, to interact. It now appears that they are rapidly replicating and essentially eating the main computer, shutting down the power, weapons, communications and life support systems on the ship, one by one.
What's more, the nanites have evolved to the point where they have become, in effect, a civilization capable of intelligent thought. When Picard refuses to destroy them, Stubbs fears that his life's work will be ruined and attempts to kill them. In retaliation, the nanites attack Stubbs and render the ship powerless.
Desperate to stop the nanites, Picard asks Data to find a way to communicate with them. The robots, distrustful of humans, refuse to agree to a cease fire. As a gesture of good faith, Data allows the nanites to enter his circuits and manipulate his verbal programs, thus using him as a conduit for face-to-face communication.
"Speaking" through Data, the nanites reveal that they meant no harm, but needed to explore the computer system. After Stubbs apologizes for trying to kill them and arranges a new home for them on planet Kavis Alpha IV, the nanites relent and even help reconstruct the computer core in time for Stubbs to complete his experiment.