The novel is set in a far future where humanity has split into two civilizations: the billions of Earthpeople who live in massive enclosed underground Cities, and the Spacers, long-lived descendants of Earth's colonists who inhabit many thinly populated worlds with vast robotic workforces. Elijah Baley, a plainclothes detective in an Earth City, has been leading a small volunteer movement to acclimatize Earthpeople to the open air, hoping to prepare humanity for eventual settlement of new worlds. He is summoned to Police Headquarters, where Undersecretary Lavinia Demachek of the Terrestrial Department of Justice explains a crisis on Aurora, the most powerful Spacer world. Dr. Han Fastolfe, a prominent Auroran politician and the Galaxy's foremost roboticist, has been implicated in the destruction of a humaniform robot, a robot designed to be virtually indistinguishable from a human being. The robot, Jander Panell, was placed into permanent mental freeze-out, a total shutdown of the positronic brain that serves as a robot's mind. Fastolfe's political enemies, who oppose Earth's expansion into the Galaxy, are using the scandal to destroy him and, with him, Earth's hopes for Galactic settlement. Fastolfe has requested Baley to investigate and clear his name. Demachek warns Baley that if he fails, Earth's government will place all blame on him personally.
Aboard the Auroran ship, Baley reunites with R. Daneel Olivaw, Fastolfe's humaniform robot and Baley's former investigative partner. Daneel briefs him on the central paradox of the case: Fastolfe publicly states that he is the only person in all the Spacer worlds with the expertise to have performed the freeze-out, yet he insists he did not do it, leaving spontaneous positronic drift, a chance malfunction in the robot's brain pathways, as the only remaining explanation. R. Giskard Reventlov, an older, nonhumaniform robot also belonging to Fastolfe, serves as Baley's guard. During the voyage, Baley uses an astrosimulator that projects the sensation of open space directly into his visual cortex. Overwhelmed, he loses consciousness, and Giskard rushes in to rescue him. After landing on Aurora, Baley meets Fastolfe, who confirms the impossible situation: If he is innocent, spontaneous chance is the only alternative, but he cannot prove it.
Baley visits Gladia, a woman originally from Solaria, a Spacer world where direct physical contact between people is taboo. Gladia was Jander's owner at the time of his destruction. In an emotionally raw confession, she reveals that Jander was not merely her robot but, in her mind, her husband. Having found Auroran sexuality equally unsatisfying after her isolated upbringing, only with Jander did she experience genuine intimacy. She kept the relationship secret from all Aurorans. Baley examines Jander's body and finds no physical damage, confirming that the destruction was entirely mental.
Returning to Fastolfe, Baley presses him about his motives for giving Jander to Gladia. Fastolfe reluctantly reveals a painful personal history: he raised his daughter, Vasilia, himself from infancy, partly as a subject of scientific observation. When she matured and offered herself to him sexually, a culturally acceptable gesture on Aurora, he refused to preserve his scientific objectivity, emotionally scarring her. Vasilia left him and became his political opponent. Fastolfe admits that Gladia's resemblance to Vasilia drew his protective instincts. Baley proposes that Gladia's conflicting emotions toward Jander could have created a contradiction that drove Jander into freeze-out, but Fastolfe rejects this: Modern humaniform robots resolve such contradictions quantitatively, making accidental freeze-out through emotional conflict astronomically unlikely. He warns that using this theory publicly would backfire, since his enemies would argue he deliberately engineered the situation.
The next day, Baley visits Vasilia at the Robotics Institute, a research community founded to crack the secret of humaniform robot construction that Fastolfe refuses to share. Vasilia gives a bitter account of her upbringing and declares she will publicly testify that Fastolfe destroyed Jander. Baley gambles: He accuses her of involvement through a conspiracy with Santirix Gremionis, a hair-and-clothing designer who has been persistently courting Gladia. Vasilia denies it, but Baley senses she is frightened by something he has touched upon and deploys a bluff about an "indirect conspiracy," which visibly unsettles her.
Baley then questions Gremionis, who reveals that Vasilia originally redirected his romantic attention from herself to Gladia, encouraging the transfer and his continued pursuit. Baley deduces that Vasilia arranged for Gremionis to take Gladia on regular walks, creating predictable absences from her establishment and leaving Jander accessible to someone else.
Baley confronts Dr. Kelden Amadiro, the jovial but calculating head of the Robotics Institute, who reveals he has already moved to have Baley expelled from Aurora. Amadiro explains the Globalist plan: humaniform robots would build new worlds replicating Aurora, allowing Aurorans to migrate without discomfort. He admits the Institute has not yet succeeded in constructing humaniform robots, confirming that without Fastolfe's knowledge, the plan cannot proceed. During their conversation, Amadiro casually refers to Jander as Gladia's "husband," a detail whose significance Baley does not yet grasp. Baley realizes Amadiro is deliberately prolonging the meeting, and when a predicted thunderstorm breaks, Baley panics at the building's exit, overwhelmed by his Earth-born terror of open weather.
Forced into the storm, Baley discovers that their airfoil, a small flying vehicle, has been sabotaged and that robots are pursuing them. He deduces that Amadiro's true target is Daneel: Any humaniform robot subjected to detailed study would reveal the secrets of its own construction. Baley orders Daneel and Giskard to flee, then misdirects the pursuing robots about his companions' whereabouts. He drags himself into the woods and collapses unconscious. Giskard returns to locate him, and Gladia brings Baley back to her establishment. That night, Gladia comes to Baley, and their intimacy provides her with emotional healing. As Baley drifts to sleep, he murmurs, "He was there first," a phrase Gladia later repeats to him, though he cannot recall its meaning.
The next morning, the Chairman of the Auroran Legislature convenes a meeting with Fastolfe, Amadiro, and Baley. Amadiro dismisses Baley's account of the sabotage and pursuit as the hallucinations of a sick Earthman. The Chairman is ready to end the investigation when Baley delivers his decisive question: How did Amadiro know that Jander was Gladia's "husband," a word she told no Auroran? Amadiro cannot explain, and under pressure he blurts out that nothing he did to the robot could possibly have immobilized it, an implicit admission that he had been secretly studying Jander during Gladia's absences. The Chairman rules Amadiro's position fatally compromised and brokers a compromise: The Galaxy will be open to Aurorans, other Spacers, and Earthpeople alike, and Fastolfe will share his humaniform knowledge with the Institute in exchange for a treaty protecting Earth.
After the meeting, Baley finally grasps the meaning of "He was there first." Sitting with Giskard, he explains his reasoning: During the astrosimulator episode aboard the ship, Giskard rushed to Baley's aid before Daneel, even though Giskard was behind a closed door and Daneel was in the room. The only explanation is that Giskard detected Baley's mental distress through the door, meaning Giskard can read minds. Giskard confirms this: The ability was accidentally given to him years ago when young Vasilia experimented with his programming. He reveals that he himself immobilized Jander, using knowledge absorbed over decades from reading Fastolfe's mind, to prevent Amadiro from learning to build humaniform robots for a plan Giskard judged harmful to humanity. Giskard further reveals he orchestrated Baley's entire visit to Aurora, subtly influencing Gladia, Fastolfe, and the Chairman, because he needed to confirm that Earthpeople, not Aurorans, must settle the Galaxy. He tells Baley he has planted the concept of "psychohistory," a future mathematical science of human behavior, in Fastolfe's mind, and promises to create other mind-reading robots to guide humanity's expansion. Giskard allows Baley to remember the conversation but removes any urge to repeat it. As they part, Giskard shakes Baley's hand and tells him that, though "World of the Dawn" is a title formerly applied to Aurora, from this point forward Earth itself is the true World of the Dawn.