Hansen was born in Omaha, Nebraska, attended a Jesuit high school, Creighton Preparatory School and earned a Bachelor's degree in English from Creighton University in Omaha in 1970. Following military service, he earned an M.F.A. from the Iowa Writers' Workshop in 1974 and held a Wallace Stegner Creative Writing Fellowship at Stanford University. He later earned an M.A. in Spirituality from Santa Clara University. Hansen has received fellowships from the Michigan Society of Fellows, the National Endowment for the Arts, the John Simon Guggenheim Foundation, and the Lyndhurst Foundation, as well as an Award in Literature from the American Academy and Institute of Arts and Letters.
Hansen is the Gerard Manley Hopkins, S.J. Professor in the Arts and Humanities at Santa Clara University, where he teaches courses in writing and literature. He is married to the writer Bo Caldwell and is the stepfather of her two children, John Scott "Scotty" Caldwell Arnold and Kate Arnold. Scotty attends Hansen's place of employment, Santa Clara University, and Kate is pursuing her medical degree at Georgetown University.
In January 2007, Hansen was ordained as a permanent deacon of the Catholic Church.
In May 2009, Hansen was inducted to the college of fellows at Dominican School of Philosophy and Theology.
Hansen frequently writes about the Old West, mixing history with morality and drama. Hansen's first novel, Desperadoes (1979), reimagines the story of the Dalton Gang. The Assassination of Jesse James by the Coward Robert Ford , a 1983 novel chronicling the life and death of the iconic outlaw, was Hansen's most popular work and brought him wide critical acclaim, as well as his being a finalist for the PEN/Faulkner Award.
Catholic themes of unconditional love, redemption and resurrection also recur in Hansen's novels and stories. Mariette in Ecstasy (1991), a study of the faith and religious experience in the context of a cloistered Catholic nun who apparently bears the stigmata, earned him near universal critical praise, as well as the fiction prize from the Bay Area Reviewers Association and the Gold Medal for Excellence in Fiction from the Commonwealth Club of California. Hansen's latest novel, Exiles (2008), tells the story of the shipwreck that cost the lives of five young nuns and prompted poet Gerard Manley Hopkins, S.J., to write some of his best work.
Hansen's 1996 novel, Atticus, about the bond of love between a father and a son who has died under mysterious circumstances in a dusty Mexican town, was a finalist for both the National Book Award and the PEN/Faulkner Award. Hitler's Niece (1999) is a historical novel that offers a view of Hitler as seen through the eyes of Geli Raubal, the daughter of his half-sister. Isn't It Romantic? (2003) is a comic novel about two sophisticated Parisians stranded in small-town Nebraska.
Hansen has published numerous short stories in literary magazines nationwide. His short story collection, Nebraska, was published in 1989. Hansen also edited the anthology You Don't Know What Love Is: Contemporary American Stories (1987) and co-edited with Jim Shepard You've Got to Read This: Contemporary American Writers Introduce Stories That Held Them in Awe (1994).
In addition to his novels and short stories, Hansen has published a compilation of essays on faith and fiction (A Stay Against Confusion) and a children's book (The Shadowmaker). Hansen also wrote the screenplay for the 1996 film adaptation of Mariette in Ecstasy.
In 2006, The Assassination of Jesse James was adapted for the screen in a film written and directed by Andrew Dominik and starring Brad Pitt as James. Initially intended for a 2006 release, the film was postponed and re-edited for a September 21, 2007 release.
In 2009, "Mariette In Ecstasy" was adapted for the stage at Lifeline Theatre in Chicago.