In the movie I Am Legend, Will Smith plays a man who lives in fear and solitude for about three years. He is driven by his desire to fix the biological disaster that seems to have wiped out all of humanity except himself. He borrows his life-motto from Bob Marley's mission in life: to "Light up the Darkness." He wants to be as dedicated as Marley in bringing good, or light, into the world.
One obvious spiritual theme in I Am Legend is Light vs. Darkness. God designed us to depend on light. Light implies reconciliation, goodness and purity. We dwell in the light if we have nothing to hide. Jesus even calls Himself the Light of the world. When we dwell in the Light, we gain spiritual sight. When we dwell in the Light we live unhindered by all that might make us want to cower in the dark.
In the movie there are two kinds of people left in the world: Light-dwellers and dark-dwellers. Will Smith is one of the few light-dwellers left in the world. The majority however are crazed zombies who can only come out at night because sunlight will burn and kill them.
The Bible says (and everyday life confirms) that we would like to hide in darkness to cover up our shameful lives. It makes sense that we should naturally hate Jesus Christ. We hate the Light because He exposes our evil deeds for what they are.
Sin is similar to the infection in I Am Legend. Sin has devastated humanity. Sin reduces people to animalistic impulses. Sin inspires people to hide in shame. Apart from God, people are enslaved by sin to the point that they can't help destroying themselves and the world around them.
In I Am Legend, the majority of people left on earth have the capacity to be productive but they are compelled by their infection to use their physical and mental facilities for killing, destruction and for infecting others. The minority, the light-dwellers, risk their lives in their attempts to save the dark-dwellers.
Toward the end of the movie (Beware: Plot spoiler!) Smith comes out as a Christ-figure before the raging zombies, holding up the blood that might cure them if they would only accept it. Smith culminates the Christ-parallel by giving the blood away and then sacrificing himself in order to make the blood available to other people. Smith also resembles Christ in that he was the only person in the whole city who was immune to this insidious infection.