Dr. Krippen (Emma Thompson) is interviewed on TV about her great discovery: she has changed the measles virus genetically so that it attacks cancerous cells. She explains that all the cancer patients which her cure has been tested on have recovered so far. The scene jumps to three years later. We see New York City has become an empty and desolate place, devoid of human life. Grass covers roads and buildings, abandoned cars line the highways and the city is silent. It seems that the apocalypse has arrived.
Robert Neville (Will Smith) is driving through the deserted city accompanied by Sam, his dog. A herd of deer leap across his path and he follows them gives chase at speed in the car. He tries to shoot them and we realise it's a hunt. The deer split up and run down a road blocked with abandoned cars. Neville gives chase on foot, trying to hunt one deer down. As he rounds a corner he gets the deer in his gun sights only to be beaten to the kill by a lion that presumably escaped from the NYC zoo. Robert is torn as to whether to shoot the lion and its family who also enter the scene or leave the deer to them. At this point his Robert's watch alarm starts beeping and he leaves, taking Sam with him. We see Neville's home, it is the typical American detached house, but it looks as though it were in the middle of a war zone. Robert and Sam have had a seemingly normal evening, eating processed food and watching tv. After a bath, Neville shuts, locks and protects every door and window with massive steel shutters. He sleeps with Sam in a bathtub, rifle in hand, with sounds of screaming surround the home.
He dreams of how Zoe (Salli Richardson), his wife, their child, Marley (Willow Smith), and Sam, as a puppy, try to leave New York. We see Robert dressed in a military uniform: he decides to stay in New York on his own in order to try to stop the virus as he is a military doctor. They tell Marley they are going on holiday. The dream scene is interrupted by Neville waking to once again face his lonely reality.
At his fortress-like home, Robert exercises and goes down to the basement, where he keeps a small but hi-tech laboratory. We see that he has been experimenting with a vaccine for the virus that has wiped out most of the human race. He's tried the vaccine, evidently only one of hundreds, on some mice in order to find a viable cure. All the mice act incredibly aggressive, except for one. Robert makes note of this mouse and deems that specific compound ready for human trials.
Later, Robert goes to a video-rental store where he talks to some mannequins he has set up, his only form of contact with the human form. It seems has created a game for himself to prevent madness from taking him. He later visits some condo flats nearby, searching for supplies and coming upon a room with a bed surrounded by plastic wrap and another room with two cribs. We see the pain in his eyes as he empathises with the loss of loved ones. Later, we hear the radio message Neville has created and plays over all AM radio frequencies. It says that he's alive, and that he'll be waiting for more survivors at the docks of the bay at midday everyday.
Sam spots a deer again, so Robert and Sam go after it. The deer runs into an old building at ground level, and Sam goes after it, although Robert has tried to hold Sam back. Robert enters the building as Sam will not return of his own accord. Carefully, Robert searches the darkened rooms. He finds the corpse of the deer and Sam, hiding under an old desk. An Infected male then leaps out of the darkness to attack Robert and is shot dead. Both Sam and Robert start running away through the building. Some more of the infected appear and chase them. He fights them all and both are able to get out of the building. The leader of the infected (Dash Mihok) cannot run after them because his skin burns as soon as he comes in contact with the sunlight, and after screaming at Neville, he retreats back to the safety of the darkness. Soon afterwards, Robert sets a trap to catch one of the infected. He succeeds and takes the captured female infected (Joanna Numata) home to his lab. He tries the vaccine that made the mouse less aggressive, but it fails and the woman flatlines. He revives her with an adrenaline shot and continues to adapt his serums in the hope of finding a cure.
That night, he again dreams of the past, when his wife and child try tried to leave New York in the chaos of its evacuation. He relives the panic and terror on the streets as the citizens of the city try to escape before the infected take control. Neville wakes again, with a deeply sad face.
The next morning, he remembers it's his birthday. When he goes to the video store, he finds his mannequins have been moved. During the night the infected have set the same trap he organized for them the previous day.. Neville is caught by the trap and passes out. When he wakes up, he is badly hurt, hanging upside down and bleeding. Sam is faithfully waiting for him. He cuts himself free finally just as dusk falls, but he falls on his knife and impales his leg. The infected leader then appears with infected dogs who attack Robert, but Sam defends him, who succeeds in crawling back to his car to retrieve a pistol, shooting the infected dogs dead. He looks over to see Sam collapse from a bite wound and picks her up and lays her in the car. When he gets home he puts Sam on a table, and injects her with an experimental vaccine. The vaccine fails in helping Sam as Neville realizes her hair begins to fall out and she attempts to bite him, so he is forced to kill her by strangling her as she struggles in his arms. Tears stream down his cheeks as he says goodbye to his only friend. He then goes and buries her in the streets on New York City.
In a grief stricken rage he decides to fight all the infected face-to-face. He drives his car at speed into the hoards of infected who roam the streets at night. He crashes and the infected overpower the vehicle. Just as he is about to die a bright light shines on him and he blacks out. While blacked out, he has dreams about the past once more. This time he dreams of the helicopter his wife and child used to escape New York. As it takes off it, a nearby helicopter is attacked by infected and crashes into the helicopter carrying his family.He wakes up in a his house to Shrek playing on the TV and stitches in his knife wound. The people who rescued him are Anna (Alice Braga) and her son Ethan (Charlie Tahan), who have heard Robert's radio message and went to find him the previous day. Anna explains a plan to leave New York, and go to a colony of immune survivors in Maryland. Robert, however, insists that he wants to be left alone and that he doesn't believe that such a place exists.
Later that evening, Robert realizes that the infected are attacking the house. The previous night they had followed Anna back when she rescued Robert. Although Robert's home defenses are comprehensive, the infected are so great in number they breach the shutters and make their way into the house. Robert, Anna and Ethan retreat to the basement lab.
During the hectic fight, Robert has time to realize that the infected female he had captured earlier and tested the virus vaccine on, has come back to her human form. He takes a sample of her blood in a syringe and gives it to Anna, telling her to leave through a small trap-door with Ethan. Robert stays back to kill as many of the infected as he can, blowing them to pieces along with himself, including the vicious alpha-male who has made a personal quest out of hunting Robert down.
Anna and Ethan reach a strange place in the middle of the countryside: the road is cut by a castle-like wall and a steel door. There, some human survivors live in that enclosed community. Anna gives the syringe with the antidote to the human leader of that small community and her voice over tells us of the legend that Robert Neville has become.
During the fight between Robert and the Infected, Robert realizes that the infected female he had captured earlier and tested the virus vaccine on, has come back to her human form.Alpha vampire makes cracks in the glass chamber (in shape of a butterfly) indicating he wants the female back. Robert removes her drug drip and moves her outside the glass chamber, saying that he's listening (to God). The alpha vampire directs other vampires not to attack Robert, who now vaccinates the female to return her to vampire form. The alpha vampire picks her up and leaves with other vampires while Robert says sorry to them for killing some vampires in his experiments.
Robert, Anna and Ethan now live together and keep on searching for other human survivors by sending messages in AM broadcasts.