In 2035, Del Spooner is a divorced detective in the Chicago P.D, who bears a strong distrust of robots and contemporary technology. He is very into retro fashion, wearing vintage 2004 Converse All-Stars leather sneakers, living in a late 90's style apartment and owning a vintage JVC CD player and 1990's alarm clock, which have long become obsolete. However, he drives a brand-new Audi RSQ.
One day, Dr. Alfred Lanning, co-founder of U.S.R and its main roboticist, dies after falling several stories from his office window. His death is marked a suicide, but Spooner, who knew Lanning, believes otherwise. With the help of robopsychologist Susan Calvin, he interrogates employees at USR, including the other co-founder and CEO Lawrence Robertson about the plausibility of Lanning's suicide.
He questions V.I.K.I (Virtual Interactive Kinetic Intelligence), the building's supercomputer system, about Lanning's death, but she is unable to provide security camera footage from the lab area due to corrupted data. Spooner also speaks with Lanning via a holographic projector that was found on Lanning's body, with the hologram affirming that the question he must ask is why Lanning would kill himself.
Spooner investigates Lanning's office, finding it unlikely that a man of Lanning's age could have broken through the safety glass windows, which is proof to Spooner that Lanning was murdered. Spooner finds a copy of Hansel & Gretel on the desk. Further searching the lab, Spooner suddenly activates a prototype of the latest USR model, the NS-5, which refuses to respond to Spooner and Calvin's orders and flees the scene.
Spooner and Calvin chase the rogue machine to an assembly factory, where it has gone for repairs after being shot in the leg by Spooner. The robot attempts to hide in a room full of 1000 identical NS-5, but is flushed out when Spooner intimidates them by shooting one. After a brief struggle between Spooner and the rogue NS-5, the robot is trapped by the police.
Back at the police station, Spooner interrogates the robot, who insists they call him "Sonny" and denies murdering Lanning. When goaded by Spooner, Sonny has an angry outburst, demonstrating his unexpected capacity for emotion. Spooner's supervisor, Lt. John Bergin, debriefs Spooner and recommends he drop the case, but this only serves to pique Spooner's interest in the robot.
Spooner visits Lanning's house and goes through his files, discovering a video clip on Lanning's computer in which Lanning mentions the idea of the "ghost in the machine". Spooner also notices surveillance strips in Lanning's office, indicating that he was being watched both at home and work.
His visit is cut short by the remote rescheduling of the house's demolition to 12 hours earlier than planned, and he is forced to escape with Lanning's cat as a Demolition robot destroys the house. Spooner goes to Calvin's apartment and explains his theory that Lanning was being watched or even kept prisoner by someone at USR, suggesting that Robertson may have been trying to cover up a problem with the robots, though he is unsure of the real motive.
Calvin accuses him of using the case as a personal vendetta against robots instead of pursuing justice for Dr. Lanning, whom she was close to as well. Angry, Spooner leaves her apartment. As Spooner is driving through a tunnel, he requests the last fifty messages between Robertson and Lanning. While waiting for his request to go through the USR mainframe, two USR trucks appear and launch dozens of NS-5 robots to attack him.
The trucks run him off the road and Spooner crashes his Audi before being attacked by a lone one-armed robot. Spooner fights back hand-to-hand, revealing that his entire left arm is bionic. The police arrive, but only after all the robots involved have been cleared away by other robots, or have self-destructed in the burning trucks. Lt. Bergin arrives and relieves Spooner of duty, not believing his story about the attack.
In the aftermath, Calvin visits him, and Spooner reveals that he wants to solve Lanning's case because Lanning helped him; revealing that he has a donated lung and a cybernetic bionical arm covered with sprayed skin, part of a USR cybernetics program for injured police officers. After asked by Calvin, Spooner reveals his story. A few years ago, he was returning from work and was driving on a bridge.
A semi-trailer truck driver fell asleep at the wheel and crashed into the driver's side of a car driven by a man named Harold Lloyd. He was killed instantly, but his 12-year old daughter Sarah was in the passenger seat. The truck smashed Lloyd's car into Spooner's car and pushed them into the river below. Spooner and Sarah were pinned in their cars and Spooner knew they were going to drown.
However, a NS-4 model was passing by and jumped on Spooner's car. It smashed through the window, and despite Spooner yelling a command to save Sarah, it saved him, leaving Sarah to drown. Calculations revealed that Spooner had a 45% chance of survival, but Sarah only had an 11% chance to survive. Spooner still was convinced that she could have lived.
Survivor's guilt and anger that the robot failed to obey his command led to his distrust and hatred for robots. Calvin goes with Spooner to his garage, where he pulls out his vintage 2005 MV Agusta F4 motorbike. He and Calvin drive back to the USR building, where Calvin gives him access to Sonny. Sonny talks further with Spooner and reveals that he can bypass the Three Laws.