You saw the alternate ending, then. As for your friend, he is slightly mistaken. Will Smith actually blew himself up in the theatrical release.
On the Wiki page, you can check out the Alternate Ending and Home Media sections to see where it's available. Also, this IMDB page details the differences. With specific reference to your question:
The ending to the Alternate Theatrical Version varies from the
original ending. Instead of blowing himself and the hemocytes up with
a grenade, Neville discovers that the hemocytes actually came for the
female he captured earlier in the movie. He relieves her of the cure
and returns her to the hemocytes. Afterwards, the hemocytes leave and
let Neville, Anna, and Ethan be. The three then are seen leaving New
York heading to Vermont's safe zone with Anna broadcasting a message
telling all other survivors that she is with Neville and is heading to
the safe zone.