It's not really possible to discuss Hancock without discussing cultural attitudes towards black-white romantic pairings in media. So let's rip the bandaid off and jump right in.
As everyone knows, Hollywood is liberal and aggressively pushes the line on racial representation in its movies. Except actually, sometimes they kind of suck.
Interracial romance was fully protected by the Supreme Court in the 70's and objecting to it has seemed the sort of thing no one could object to without being a completely retrograde racist for decades. Except when you look at major motion pictures, there is an astonishing paucity of black-man/white-woman romances. Like, what movie before 2010 can you name that had one?
In fact, in The Pelican Brief, adapted from the John Grisham novel, the movie removed the romance plot between the two main characters - Denzel Washington and Julia Roberts - that was originally in the book. Since when has Hollywood been accused of de-sexing an adaptation?
So it seems this is the sort of thing that, while preaching multicultural tolerance and the sovereignty of love in general, commercial studios have shied away from in fear of off-putting audiences. In particular they were really afraid of showing a black man ever being involved with a white woman, in a way that probably inhibited the careers of leading black actors like Denzel Washington and Idris Elba. (Since 2012 this seems to have finally lifted, with even Will Smith having a successful romance in "Focus").
So, the literal backstory plot of Hancock is that Hancock was married to Mary and they were attacked in broad daylight by people who resented them. As Mary says "they used me to get to you." Mary concludes she needs to avoid Hancock for both their safeties.
Given how emphatically their backstory is about racial oppression, it's uh, hard not to read that as a commentary on society not tolerating a black-white romance. Evil racists wanted to keep them apart.
Which is not an uncommon plot point for a movie about racial strife and overcoming that. And then Hancock and Mary get attacked again, vulnerable because of their affection towards each other. Again, this would be pretty common for any story using a relationship as a metaphor for social justice. They shall overcome these violent bigots!
Except, uh, they don't. Hancock does not reunite with Mary. In fact, the most heroic moment of the movie is him giving her up, so that she may live. It's really an extremely affecting scene, and the climax of Hancock's development contrasted to his earlier goofy antics.
But it's pretty uncomfortable to realize that the anti-miscegenenists won. Like yes, Mary is devoted to her husband and step-child and it's perfectly reasonable for her to want to stay with him. But diagetically the superhuman rules are pretty clear that "Hancock needs to stay away from, or she will die." And that is bowed to as reality, not something to be overcome.