The Enterprise travels to the home of Ira Graves, a brilliant but desperately ill scientist. While en route, they receive a distress call from a nearby ship. Although they depart to help the Constantinople, they drop off Troi, Worf, Data, and Dr. Selar, a Vulcan, at near-warp velocities on Graves's world. Graves's assistant, the lovely Kareen Brianon, greets them. When asked why she abruptly cut off transmission earlier, it's revealed that Dr. Graves didn't know they were coming. Graves appears, quite irascible, but he grudgingly allowed Selar to examine him. While she does this, he becomes fascinated by Data. He claims to have taught Noonian Soongh, Data's creator, everything he knew, and refers to himself as Data's grandfather. Selar then reports: Graves has Darnay's disease, which is terminal.

Graves starts talking only to Data and retreats into seclusion with him. He insists Data call him "Grandpa", and reveals that he doesn't actually believe he'll die, as he's learned a way to transfer his mind into a computer. When Data, while discussing death, mentions his "off" switch, Graves gets a cunning look in his eye. While Troi, Worf and Selar discuss Graves with Kareen (and Troi tells her that Graves is quite attracted to her), Data comes out and says Graves just died a few minutes ago, in his arms.

The Enterprise, which has by now returned, beams back the away team, and prepares to take Kareen to a starbase. Data, however, starts acting a bit strangely. He delivers an overly sentimental speech at Graves's funeral, and seems to be becoming attracted to Kareen. Picard talks to Data later, but is convinced he's just been trying a bit too hard to be human. This opinion changes, however, when Data becomes insubordinate, and accuses Picard of having "unprofessional" intentions toward Kareen. Troi, unbelievably, senses jealousy from Data. Picard orders Data to submit to an examination by Geordi, and when that comes up empty, Deanna gives him a psychiatric test.

She then reports her disturbing results to Picard: there are two different personalities in Data's mind, and the irrational one is growing, to the extent that the Data they know may soon be lost. Data, meanwhile, goes to Ten-Forward, where he tells Kareen that he is Graves, transferred into Data. He declares his love for her, and says he'll build an android body for her as well. When she declines, he accidentally hurts her, then departs for Engineering.

Picard confronts Data/Graves in Engineering and demonstrates to him how violent he's become. After punching Picard out, Graves is filled with remorse, and leaves Data's body, downloading himself into the Enterprise computer. There, his knowledge stays intact, but not his consciousness. Data revives, intact, but with no memory of what happened.