Robert Neville is the main character from the book "I Am Legend" by Richard Matheson.
Neville is apparently the only survivor of an apocalypse caused by a pandemic of bacteria, the symptoms of which are similar to vampirism. He spends every day repairing his house, boarding up windows, stringing and hanging garlic, disposing of vampires' corpses on his lawn and going out to gather any additional supplies needed for hunting and killing more vampires.
Much of the story is devoted to Neville's struggles to understand the plague that has infected everyone around him, and the novel details the progress of his discoveries.
One day a dog appears in the neighborhood. Neville spends weeks trying to win its trust and domesticate it. He eventually traps the terrified dog and wins it over, but it dies from the vampire infection a week later.
As the story progresses, it is revealed that some infected people have discovered a means to hold the disease at bay. However, the "still living" people appear no different from the true vampire during the day while both are immobilized in sleep. Thus, along with the vampires, Neville kills the still living people. He becomes a source of terror to the still living, since he can go around in daylight (which they can only do for a short length of time using a special pill) and kill them while they sleep.
They send a still living woman named Ruth to spy on Neville, and they replicate Neville's relationship with the dog. Ruth, terrified of Neville at first sight, goes against her role of spying on him and runs away. Rather than spend weeks trying to win her over, he attacks her and drags her back to his house. Eventually Neville performs a blood test on her, revealing her true nature to him right before she knocks him out with a mallet. Ruth leaves a note telling him about the group of people like her, explaining that she was sent to spy and how monstrous he appears to them. Months later, the still living people attack, injuring Neville, but taking him alive so that he can be executed in front of everyone in the new society (which Neville finds very primitive).
Before he can be executed, Ruth provides him with an envelope of pills. Neville takes the pills to commit suicide before the still living execute him. As he dies he reflects on how the new society of the living infected regards him as a monster. Just as vampires were regarded as legendary monsters that preyed on the vulnerable humans in their beds, Neville has become a mythical figure that kills both vampires and the infected living while they are sleeping. He becomes a legend as the vampires once were, hence the title.
Buuuuuuut this isn't the book so let's talk about the character from the movie shall we? Robert Neville is possibly the only survivor of a virus that swept the world and turned its inhabitants into zombie like creatures. he works out regularly and hunjts for food with his dog sam. Sam dies after a hunt gone wrong and Neville is nearly killed himself. He goes on a vengeful killing spree of the infected and is nearly killed by the leader but is then saved by another survivor Anna and a young boy Ethan After getting to know them both a little Nevilles house is attacked by the infected. After retreating to his laboratory Neville evacuates Ethan and Anna into a coal chute, discovering he has found the cure for infection. he gives the cure to Anna before closing the door to the chute and sacrificing himself by running into the crown of infected with a hand grenade.
Of course that is the theatrical ending, if we wanna go with the far superior directors cut ending then neville doesn't sacrifice himself. Whilst they hide in his lab the infected raid it and the alpha male makes the shape of a butterfly on the lab glass. Neville realises that he is referring to the female Neville has captured (with her butterfly tattoo) he takes her out to the alpha male and takes the cure out of the females veins. They then show signs of love and compassion for one another, leaving Neville realising that, infact, the infected are not mindless killing machines but have developed a community of their own and have still got traces of their humanity. He apologises to the alpha male and waits for the infected to kill him. However, they leave, letting Neville go. He looks over at the pictures of the hundreds of infected he has killed, in remorse. The film ends with Neville, Anna and Ethan driving off to find the colony with Anna recording a message over the radio for other survivors.