Warner Bros. began developing I Am Legend in 1994, and various actors and directors were attached to the project, though production was delayed due to budgetary concerns related to the script. Production began in 2006 in New York City, filming mainly on location in the city, including a $5 million scene[5] at the Brooklyn Bridge.

Neville's daily routine includes experimentation on infected rats to find a cure for the virus and trips through a deserted Manhattan to hunt for food and supplies. He also waits each day for a response to his continuous recorded radio broadcasts, which instruct any uninfected survivors to meet him at midday at the South Street Seaport. Flashbacks reveal that his wife and daughter died in a helicopter accident during the chaotic evacuation of Manhattan, prior to the military-enforced quarantine of the island in 2009. Neville's isolation is broken only by the companionship of his dog, Sam, interaction with mannequins he has set up as patrons of a video store, and recordings of old television broadcasts. At night, he barricades himself and Sam inside his house to hide from the Darkseekers.

Neville finds a promising treatment derived from his own blood, so he sets a snare trap and captures a female Darkseeker while a male Darkseeker watches from the shadows. Back in his laboratory, located in the basement of his heavily-fortified Washington Square Park home, Neville treats the female without success. Shortly thereafter, he is ensnared in a trap similar to the one he used to capture the female. By the time Neville escapes it is dark and he is attacked by infected dogs, one of which bites Sam. Initially Neville brings Sam home and injects her with a strand of his serum, but when she shows signs of infection and tries to attack him, Neville is forced to strangle her. The next night, driven over the edge by loneliness, he goes out and attacks a group of Darkseekers. He is nearly killed, but is rescued by a pair of immune survivors, Anna (Alice Braga) and a young boy named Ethan (Charlie Tahan), who have traveled from Maryland after hearing one of his broadcasts. They take the injured Neville back to his home where Anna explains that they survived the outbreak aboard a Red Cross evacuation ship from São Paulo and are making their way to a putative survivors' camp in Bethel, Vermont.

Neville once again attempts to administer a potential cure to the infected woman in his laboratory, but the next night a group of Darkseekers, who had followed Anna and Neville back the night before, attack the house and overrun its defenses. Neville, Anna, and Ethan retreat into the basement laboratory, sealing themselves in with the female Darkseeker Neville has been experimenting upon. Discovering that the last treatment has been successful, Neville draws a vial of her blood and gives it to Anna, before shutting her and Ethan inside a coal chute in the back of the lab. As one of the Darkseekers breaks into the laboratory, Neville detonates a grenade, killing the Darkseekers and himself. Anna and Ethan emerge the next morning and make their way to the survivor colony. Once there, Anna hands over the blood containing the cure.

Will Smith as Dr. Robert Neville: A former U.S. Army medical doctor and scientist before the worldwide plague. He loses his wife and daughter in a helicopter crash shortly after Manhattan is quarantined and spends the next three years trying to find a cure while defending himself against the Darkseekers. He is immune to the virus and uses vials of his blood to try to create a cure.

Alice Braga as Anna Montez: A survivor from Brazil, who spent days harbored on a Red Cross ship in Philadelphia; after the city was overrun, she stayed with Ethan and several other survivors on the ship, but eventually, only she and Ethan survived, since they were immune and the others were either infected or killed. She followed Neville's broadcasts to track him.

Charlie Tahan as Ethan: A boy from Philadelphia who spent days on the ship with Anna and accompanied her when the ship was overrun.

Actors Tom Cruise, Michael Douglas,[8] and Mel Gibson[6] had been considered to star in the film,[8] using a script by Protosevich and with Ridley Scott as director; however, by June 1997 the studio's preference was for actor Arnold Schwarzenegger. In July, Scott and Schwarzenegger finalized negotiations,[9] with production slated to begin the coming September,[8] using Houston as a stand-in for the film's setting of Los Angeles.[10] Scott had Protosevich replaced by a screenwriter of his own choosing, John Logan, with whom he spent months of intensive work on a number of different drafts. The Scott/Logan version of I Am Legend was a mix of sci-fi and psychological thriller, without dialogue in the first hour and with a sombre ending.[6] The creatures in Logan's version were similar to the Darkseekers of the finished film in their animalistic, barbaric nature. The studio, fearing its lack of commercial appeal and merchandising potential, began to worry about the liberties they had given Scott – then on a negative streak of box office disappointments – and urged the production team to reconsider the lack of action in the screenplay. After an "esoteric" draft by writer Neal Jimenez, Warner Bros. reassigned Protosevich to the project, reluctantly working with Scott again.[6]

In December 1997, the project was called into question when the projected budget escalated to $108 million due to media and shareholder scrutiny of the studio in financing a big-budget film.[11] Scott rewrote the script in an attempt to reduce the film's budget by $20 million,[12] but in March 1998, the studio canceled the project due to continued budgetary concerns,[13] and quite possibly to the box office disappointment of Scott's last three films, 1492: Conquest of Paradise, White Squall, and G.I. Jane.[6] Likewise, Schwarzenegger's recent films at the time (Eraser and Warner Bros. own Batman & Robin) also underperformed, and the studio's latest experiences with big budget sci-fi movies Sphere and The Postman were negative as well.[6] In August 1998, director Rob Bowman was attached to the project,[14] with Protosevich hired to write a third all-new draft, far more action-oriented than his previous versions,[6] but the director (who reportedly wished for Nicolas Cage to play the lead) moved on to direct Reign of Fire[15] and the project did not get off the ground.

In March 2002, Schwarzenegger became the producer of I Am Legend, commencing negotiations with Michael Bay to direct and Will Smith to star in the film.[16] Bay and Smith were attracted to the project based on a redraft that would reduce its budget.[17] However, the project was shelved due to Warner Bros. president, Alan F. Horn's dislike of the script.[18] In 2004, Akiva Goldsman was asked by head of production Jeff Robinov to produce the film.[19] In September 2005, director Francis Lawrence signed on to helm the project, with production slated to begin in 2006. Guillermo del Toro was originally approached to direct by Smith but turned it down in order to direct Hellboy II: The Golden Army.[20] Lawrence, whose film Constantine was produced by Goldsman, was fascinated by empty urban environments. He said, "Something's always really excited me about that... to have experienced that much loss, to be without people or any kind of social interaction for that long."[19]

Goldsman took on the project as he admired the second I Am Legend film adaptation, The Omega Man.[21] A rewrite was done to distance the project from the other zombie films inspired by the novel,[16] as well as from the recently released 28 Days Later, although Goldsman was inspired by the scenes of a deserted London in the British horror film to create the scenes of a deserted New York City.[21] A 40-page scene-by-scene outline of the film was developed by May 2006. When delays occurred on Smith's film Hancock, which was scheduled for 2007, it was proposed to switch the actor's films. This meant filming would have to begin in sixteen weeks: production was green lit, using Goldsman's script and the outline.[19] Elements from Protosevich's script were introduced, while the crew consulted with experts on infectious diseases and solitary confinement.[21] Rewrites continued throughout filming, because of Smith's improvisational skills and Lawrence's preference to keep various scenes silent.[19] The director had watched Jane Campion’s film The Piano with a low volume so as to not disturb his newborn son, and realized that silence could be very effective cinema.[22]

Will Smith signed on to play Robert Neville in April 2006.[23] He said he took on I Am Legend because he felt it could be like "Gladiator [or] Forrest Gump—these are movies with wonderful, audience-pleasing elements but also uncompromised artistic value. [This] always felt like it had those possibilities to me."[21] The actor found Neville to be his toughest acting challenge since portraying Muhammad Ali in Ali (2001). He said that "when you're on your own, it is kind of hard to find conflict." The film's dark tone and exploration of whether Neville has gone insane during his isolation meant Smith had to restrain himself from falling into a humorous routine during takes.[24] To prepare for his role, Smith visited the Centers for Disease Control and Prevention in Georgia. He also met with a person who had been in solitary confinement and a former prisoner of war.[25] Smith compared Neville to Job, who lost his children, livelihood, and health. Like the Book of Job, I Am Legend studies the questions, "Can he find a reason to continue? Can he find the hope or desire to excel and advance in life? Or does the death of everything around him create imminent death for himself?"[16] He also cited an influence in Tom Hanks' performance in Cast Away (2000).[21]

Abbey and Kona, both three-year-old German Shepherd Dogs, played Neville's dog Sam.[26] The rest of the supporting cast consists of Salli Richardson as Zoe, Robert's wife,[27] and Alice Braga as a survivor named Anna.[27]Willow Smith, Will Smith's daughter, makes her film debut as Marley, Neville's daughter.[28]Emma Thompson has an uncredited role as Dr. Alice Krippin, who appears on television explaining her vaccine for cancer that mutates into the virus.[29] Singer Mike Patton provided the guttural screams of the infected "hemocytes," and Dash Mihok provided the character animation for the infected "alpha male". There were several filler characters with uncredited roles in old news broadcasts and flashbacks, such as the unnamed President's voice (Pat Fraley), and the cast of The Today Show.

Akiva Goldsman decided to move the story from Los Angeles to New York City to take advantage of locations that would more easily show emptiness.[7] Goldsman explained, "L.A. looks empty at three o'clock in the afternoon, [but] New York is never empty . . . it was a much more interesting way of showing the windswept emptiness of the world."[24] Warner Bros. initially rejected this idea because of the logistics,[19] but Francis Lawrence was determined to shoot on location, to give the film a natural feel that would benefit from not shooting on soundstages. Lawrence went to the city with a camcorder, and filmed areas filled with crowds. Then, a special effects test was conducted to remove all those people. The test had a powerful effect on studio executives.[22] Michael Tadross convinced authorities to close busy areas such as the Grand Central Terminal viaduct, several blocks of Fifth Avenue and Washington Square Park.[19] The film was shot primarily in the anamorphic format, with flashback scenes shot in Super 35.[30]

Filming began on September 23, 2006.[31] The Marcy Avenue Armory in Williamsburg was used for the interior of Neville's home,[24] while Greenwich Village was used for the exterior.[16] Other locations include the Tribeca section of Lower Manhattan, the aircraft carrier Intrepid, the Kingsbridge Armory in the Bronx and St. Patrick's Cathedral.[7] Weeds were imported from Florida and were strewn across locations to make the city look like it had overgrown with them.[19] The closure of major streets was controversial with New Yorkers. Will Smith said, "I don't think anyone's going to be able to do that in New York again anytime soon. People were not happy. That's the most middle fingers I've ever gotten in my career."[16]

A bridge scene was filmed for six consecutive nights in January on the Brooklyn Bridge to serve as a flashback scene in which New York's citizens evacuate the city. Shooting the scene consumed $5 million of the film's reported $150 million budget, which was likely the most expensive shot in the city to date. The scene, which had to meet requirements from 14 government agencies, involved 250 crew members and 1,000 extras, including 160 National Guard members.[32][33] Also present were several Humvees, three Strykers, a 110-foot (34 m) cutter, a 41-foot (12 m) utility boat, and two 25-foot (7.6 m) response boat small craft, as well as other vehicles including taxis, police cars, fire trucks, and ambulances.[34] Filming concluded on March 31, 2007.[31]CGI was used to depict the main spans of the Brooklyn Bridge and the Manhattan Bridge collapsing as missiles from over passing military jets blew them up to quarantine Manhattan island.

Reshoots were conducted around November 2007. Lawrence noted, "We weren't seeing fully rendered shots until about a month ago. The movie starts to take on a whole other life. It's not until later that you can judge a movie as a whole and go, 'Huh, maybe we should shoot this little piece in the middle, or tweak this a little bit.' It just so happened that our re-shoots revolved around the end of the movie."[35]

A week into filming, Francis felt the infected (referred to as "Dark Seekers" or "hemocytes" in the script), who were being portrayed by actors wearing prosthetics, were not convincing. His decision to use CGI resulted in an increased budget and extended post-production, although the end results were not always well received.[36][37] The concept behind the infected was that their adrenal glands were open all of the time and Lawrence explained, "They needed to have an abandon in their performance that you just can’t get out of people in the middle of the night when they’re barefoot. And their metabolisms are really spiked, so they’re constantly hyperventilating, which you can’t really get actors to do for a long time or they pass out."[19] The actors remained on set to provide motion capture.[24][38] "The film's producers and sound people wanted the creatures in the movie to sound somewhat human, but not the standard," so Mike Patton, lead singer of Faith No More, was engaged to provide the screams and howls of the infected.[39]

In addition, CGI was used for the lions and deer in the film, and to erase pedestrians in shots of New York. Workers visible in windows, spectators and moving cars in the distance were all removed. In his vision of an empty New York, Lawrence cited John Ford as his influence: "We didn't want to make an apocalyptic movie where the landscape felt apocalyptic. A lot of the movie takes place on a beautiful day. There's something magical about the empty city as opposed to dark and scary that was the ideal that the cast and crew wanted."[21]

Several scenes were changed before the film's release, especially the stand-off between Neville and the Darkseekers in his laboratory. In the ending, the alpha male makes a butterfly-shaped smear on the glass. Neville realizes that the alpha male is identifying the female he was experimenting upon by a butterfly tattoo, and the alpha male wants her back. Neville puts his gun down and returns the female. Neville and the alpha male both stare each other down; Neville apologizes to the Darkseekers; the alpha male accepts his apology, and the Darkseekers leave. Shocked by the ordeal, Neville sits down for a moment in his laboratory. Looking over the pictures of his numerous test subjects, the implications of his research methods begin to dawn on him. The final shot follows Neville, Anna, and Ethan as they drive away towards the survivor's camp in Vermont with the antidote.[40]

I Am Legend was originally slated for a November 21, 2007 release in the United States and Canada,[41] but was delayed to December 14, 2007.[42] The film opened on December 26, 2007 in the United Kingdom,[43] and Ireland having been originally scheduled for January 4, 2008.[24]

In December 2007, China banned the release of American films in the country,[44] which is believed to have delayed the release of I Am Legend. Will Smith spoke to the chairman of China Film Group about securing a release date, later explaining, "We struggled very, very hard to try to get it to work out, but there are only a certain amount of foreign films that are allowed in."[25]

Premieres were held in Tokyo, New York and London. At the London premiere in Leicester Square, British comedian and actor Neg Dupree was arrested after pushing his way onto the red carpet and running around shouting 'I am Legend!'.[45] The stunt was part of his 'Neg's Urban Sports' section of comedy game show Balls of Steel.

A tie-in comic from DC Comics and Vertigo Comics has been created, I Am Legend: Awakening.[46] The project draws upon collaboration from Bill Sienkiewicz, screenwriter Mark Protosevich, and author Orson Scott Card. The son of the original book's author, Richard Christian Matheson, also collaborated on the project. The project will advance from the comic to an online format in which animated featurettes (created by the team from Broken Saints) will be shown on the official website.[47]

In October 2007, Warner Bros. Pictures in conjunction with the Electric Sheep Company launched the online multiplayer game I Am Legend: Survival in the virtual world Second Life. The game is the largest launched in the virtual world in support of a film release, permitting people to play against each other as the infected or the uninfected across a replicated 60 acres (240,000 m2) of New York City.[48] The studio also hired the ad agency Crew Creative to develop a website that would be specifically viewable on the iPhone.[49]

I Am Legend grossed $77,211,321 on its opening weekend in 3,606 theaters, averaging $21,412 per venue, and placing it at the top of the box office. This set a record for highest grossing opening for a film for the month of December.[50] The film grossed $256,393,010 in North America and a total of $585,349,010 worldwide.[51] The film was the sixth highest grossing film of 2007 in North America, and as of April 2014 it still stands among the top 100 all-time highest grossing films both domestically and worldwide (unadjusted for ticket price inflation).[51]

The film was released on DVD on March 18, 2008 in two editions: a one-disc release, including the movie with four animated comics ("Death As a Gift," "Isolation," "Sacrificing the Few for the Many," and "Shelter"), and other DVD-ROM features; and a two-disc special edition that includes all these extras, an alternative theatrical version of the movie with an alternate ending,[52] and a digital copy of the film.[53] On the high-definition end, the movie has been released on the Blu-ray Disc format and HD DVD format along with the DVD release; with the HD-DVD version being released later on April 8, 2008.[54] Both HD releases include all the features available in the two-disc DVD edition.[54] A three-disk Ultimate Collector's Edition was also released on December 9, 2008.[55]

The film has sold 7.04 million DVDs and earned $126.2 million in revenue, making it the sixth best-selling DVD of 2008.[56] However, Warner Bros was reportedly "a little disappointed" with the film's performance on the DVD market.[57]

Most critics were favorable towards the film.[58] The consensus among favorable reviews was that Will Smith's performance overcame questionable special effects.[59] Review aggregation website Rotten Tomatoes gave the film a score of 70%, based on 209 reviews.[60] At the similar website Metacritic, which assigns a rating out of 100 to each review, the film has received an average score of 65, based on 37 reviews.[61]

A. O. Scott wrote that Will Smith gave a "graceful and effortless performance" and also noted the "third-act collapse". He felt that the movie "does ponder some pretty deep questions about the collapse and persistence of human civilization".[62]Dana Stevens of Slate wrote that the movie lost its way around the hour mark, noting that "the Infected just aren't that scary."[29]NPR critic Bob Mondello noted the film's subtext concerning global terrorism and that this aspect made the film fit in perfectly with other, more direct cinematic explorations of the subject.[63]Richard Roeper gave the film a positive review on the television program At the Movies with Ebert & Roeper, commending Will Smith as being in "prime form," also saying there are "some amazing sequences" and that there was "a pretty heavy screenplay for an action film."[64] The film has been criticized for diverging from Matheson's novel, especially in its portrayal of a specifically Christian theme.[65] Much of the negative criticism has concerned the film's third act,[36][37][66] some critics favoring the alternative ending in the DVD release.[52]

Popular Mechanics published an article on December 14, 2007[67] addressing some of the scientific issues raised by the film:

the plausibility of a retrovirus spreading out of control as depicted in the film. (The measles virus depicted in the film, however, is not a retrovirus, but is in fact a part of the Paramyxovirus family.)

the mechanics of the Brooklyn Bridge's destruction

The magazine solicited reactions from Alan Weisman, author of The World Without Us, virologist W. Ian Lipkin, M.D., and Michel Bruneau, PhD, comparing their predictions with the film's depictions. The article raised the most questions regarding the virus' mutation and the medical results, and pointed out that a suspension bridge like the Brooklyn Bridge would likely completely collapse rather than losing only its middle span. Neville's method of producing power using gasoline-powered generators seemed the most credible: "This part of the tale is possible, if not entirely likely," Popular Mechanics editor Roy Berendsohn says.

Philosopher Slavoj Zizek criticized the film politically as being the most regressive adaptation from the novel (others being The Last Man on Earth in 1964 and The Omega Man in 1971). He claimed that while the original novel had a progressive multicultural message where Neville became a "legend" to the new creatures and is subsequently killed by them (much like vampires were legends to humans); the 2007 film finds a cure for the Darkseekers and it is delivered by a survivor through apparent divine intervention. According to Zizek this misses the original message and "openly opt[s] for religious fundamentalism."[68]

Francis Lawrence said in late 2008 that there would be a prequel and that Will Smith would be reprising his role. He stated that the film would reveal what happens to Neville before the infected take over New York. D. B. Weiss was recruited to write the script, while Lawrence would direct "if we figure out the story". Smith stated the film would have Neville and his team going from New York City to Washington, D.C. and back again, as they made their last stand.[74] The film would again explore the premise of what it's like to be alone, as Lawrence explained, "... the tough thing is, how do we do that again and in a different way?"[75]

On May 3, 2011, Francis Lawrence stated that, so far as it involved him, the prequel was dead, with Lawrence stating, "I don't think that's ever going to happen."[76]

In 2012, Warner Bros. announced that deals had been made to produce "another installment" (not necessarily the rumored prequel), with the intention of having Will Smith reprise his role.[77]

In April 2014, Warner Bros. bought a spec script entitled A Garden at the End of the World, described as a post-apocalyptic variation of The Searchers. Studio executives found so many similarities to I Am Legend in the screenplay that they asked the writer, Gary Graham, to rewrite it so it could serve as a reboot of the earlier film, hoping to create a new franchise. Will Smith, who is known for his reluctance to appear in sequels,[78] is not expected to appear in the new film.[78]