Hartnett was born in Saint Paul, Minnesota, and was raised by his father, Daniel Hartnett, a building manager, and his stepmother, Molly, an artist. He has three younger half-siblings. He is of mainly Irish ancestry and was raised Roman Catholic, attending Nativity of Our Lord Catholic Grade School, where he played Adam Apple in an eighth grade production of "Krazy Kamp". He later attended Cretin-Derham Hall High School before switching to South High School in Minneapolis, Minnesota, from which he graduated in June 1996.
Hartnett was active in sports as a child, especially football, and did not entertain the thought of becoming a performer, until an injury left him unable to participate on the athletic playing field. A relative encouraged him to audition for a stage production of Tom Sawyer at Youth Performance Company and to his surprise, he won the part of Huckleberry Finn. Now in love with the stage, he went on to star in a slew of high school plays.
He made his feature film debut in 1998 in Halloween H20: 20 Years Later, followed by teen roles in films such as The Faculty and The Virgin Suicides. Hartnett has since gained fame for his roles in films such as Pearl Harbor, Black Hawk Down, 40 Days and 40 Nights and 30 Days of Night, and has starred for a variety of well-known directors such as Ridley Scott, Brian De Palma, Robert Rodriguez, Tran Anh Hung, Roland Joffé and Michael Bay.
Hartnett got his first job at a local video store. He became a vegetarian at the age of 12 but ate meat during the shooting of The Black Dahlia for his role as a boxer.
After finishing high school, a move to New York to attend the Conservatory of Theatre Arts & Film at SUNY Purchase did not go as well as he had hoped for, and a year later at age 19, Hartnett found himself in California. Shortly after arriving in Los Angeles, he caught an improbable break, landing a part in the short-lived but acclaimed drama Cracker, on ABC. Although the series was cancelled after sixteen episodes, Hartnett had made a name for himself. He then began to focus on feature film work.
In April 1997, Hartnett made his screen debut playing the role of Michael Fitzgerald on the short-lived television series, Cracker. He performed in small plays and on national television commercials before being cast in his first feature film, playing the son of Jamie Lee Curtis' character in Halloween H20: 20 Years Later. Released on August 5, 1998, it performed well at the box office.
Hartnett has since developed a steady film career, having appeared in many Hollywood films, including The Faculty, Black Hawk Down, Lucky Number Slevin and Pearl Harbor. He was originally set to play the role of Tino in Deuces Wild, but dropped out to star in Pearl Harbor. In 2002, he starred in O, an adaptation of William Shakespeare's Othello set in an American high school, as Hugo, the film's version of Iago. In the early 2000s, Hartnett was approached several times to play the role of Clark Kent/Superman in the upcoming film (at the time helmed by Brett Ratner), but always turned it down, not wanting to commit to a predicted ten-year role.
Hartnett was chosen as one of Teen People magazine's "21 Hottest Stars Under 21" in 1999, Teen People's "25 Hottest Stars under 25", and one of People magazine's "50 Most Beautiful People", both in 2002. He was also voted Bliss magazine's "3rd Sexiest Male", and in 2003 PETA named him the Sexiest Vegetarian Alive, as chosen by voters.
One of Hartnett's next films was the drama-mystery The Black Dahlia, in which he played a detective investigating the notorious real-life murder of actress Elizabeth Short. Hartnett had been cast in the role five years before the film was produced, remaining committed to appearing in the film because he liked the subject matter.
Among his 2007 roles were Resurrecting the Champ, a drama also starring Samuel L. Jackson, and the graphic novel-based 30 Days of Night, in which he played a small-town sheriff. Hartnett described the second film as "supernatural, but kind of a western". He was going to play trumpet player, Chet Baker, in the film The Prince of Cool, but did not agree with the producer's ideas and left the project. He took time out from filming to support the 2007 green lifestyle campaign of Global Cool.
In 2008, Hartnett played Charlie Babbit alongside Adam Godley in the theatre adaptation of Barry Morrow's Academy Award-winning Rain Man at the Apollo Theatre in London's West End. He starred in the new campaign of the Emporio Armani fragrance, "Diamonds for Men", being featured in both print and TV ads for the fragrance, thus becoming the first male celebrity to represent Giorgio Armani Beauty.
He has been featured on many magazine covers, such as Cosmogirl, Details, Entertainment Weekly, Girlfriend, Seventeen, Vanity Fair, GQ and Vman, in addition to being in other magazines like Vogue, ELLE, People, Glamour, Intouch and InStyle.
In 2009, Hartnett produced the video clip for the rapper Kid Cudi's song Pursuit of Happiness.