John Hancock (Will Smith) is an alcoholic man with superhero powers, including flight, invulnerability, and super-strength. Though he uses his powers to stop criminals in his current residence of Los Angeles, his activity inadvertently causes millions of dollars in property damage due to his constant intoxication. As a result, he is routinely jeered at the crime scenes. Hancock also ignores court subpoenas from the city of Los Angeles to address the property damage he has caused.
When public relations spokesperson Ray Embrey (Jason Bateman) departs from an unsuccessful meeting pitching his All-Heart logo for corporations who are extraordinarily charitable, he becomes trapped on railroad tracks with an incoming freight train. Hancock saves Ray's life, but he causes the train to derail and nearly injures another driver. Hancock is jeered by other drivers for causing more damage, but Ray steps in and publicly thanks Hancock for saving his life. Ray offers to improve Hancock's public image, and Hancock grudgingly accepts. The spokesperson convinces the alcoholic superhero to permit himself to be jailed for outstanding subpoenas so they can show Los Angeles how much the city really needs Hancock. When the crime rate rises after Hancock's incarceration, the superhero is contacted by the Chief of Police. Reluctantly donning a new costume (which has been provided by Ray), Hancock foils a bank robbery, aiding a wounded officer and stops the leader of the robbers, Red Parker (Eddie Marsan) from detonating explosive-laden vests attached to the bank hostages.
After the rescue, onlookers applaud Hancock for his handling of the bank robbery. The superhero becomes popular once more, as Ray had predicted. He goes out to dinner with Ray and his wife Mary (Charlize Theron), with whom he reveals his apparent immortality and his amnesia stemming from an incident some 80 years prior. After Hancock tucks a drunken Ray in bed, Hancock approaches and kisses Mary. At first, she responds passionately, but then turns angry, throwing Hancock through a wall and into the street. Hancock departs, confused at having apparently found another like himself. The next morning, Hancock arrives back at the house to demand answers from Mary. She warns him to stay away from her and her family, but agrees to meet Hancock at his home to answer his questions. When she arrives, Hancock discovers that Mary also has superpowers and is also apparently immortal. He threatens to expose her unless she explains their origins, and she tells him that they are the last two members of a race that have lived for 3,000 years with their powers. Mary lies and claims that they are brother and sister, which Hancock dismisses, given the nature of the previous night's kiss. Hancock realizes that Mary is not being entirely truthful, and he departs to tell Ray about her. The exchange results in a battle between Hancock and Mary that takes them to downtown Los Angeles, causing significant damage to the area. Ray, downtown in a business meeting, sees and recognizes Mary using superhero powers similar to those of Hancock. Ray departs his meeting and arrives home just in time to see Mary land in the backyard, followed closely by Hancock. She then reveals that, although he doesn't remember it, Hancock is her husband. The three then quietly go their separate ways.
Later that night, Hancock is shot twice in the chest and wounded when he stops a liquor store robbery. After being hospitalized, Mary enters and explains that as each pair of immortals pair up, they begin to lose their powers and live out the remainder of their lives as ordinary humans, growing old and eventually dying. She then begins to point out various scars that Hancock has acquired over the centuries, the result of his normally heroic nature. She also explains that Hancock was savagely attacked in an alley 80 years prior, which caused his amnesia. In each instance, Mary chose to leave him in order for him to regain his powers and recover from his injuries. The conversation is interrupted when the hospital is raided by Red Parker, and two men that Hancock had humiliated during his incarceration. Mary is caught in the cross-fire and is mortally wounded. Hancock is able to stop two men but suffers additional injuries in the process. When Red attempts to finish Hancock off, Ray comes to the rescue and kills the bank robber with a fire axe. With Mary dying, Hancock flees the hospital so their parting will allow her to heal with her powers. He make several clumsy leaps away from the hospital, each of longer distance and duration as his powers slowly return, until he finally is able to fly off into the night. He later takes up residence in New York City. Ray is seen walking with Mary discussing historical events such as the reign of Attila the Hun in a jovial manner. As gratitude to Ray, Hancock paints Ray's All-Heart logo on the moon and calls the spokesperson to look up to the worldwide advertisement.
In a mid-credits scene, Hancock, now living in New York City, confronts a fleeing criminal with the police. Cornered, the man takes a hostage and jeeringly demands Hancock escort him to safety. Hancock turns back and smiles as the credits resume.
Output: How do Hancock and Ray meet?