The first time I ever read the word "anti-hero," it was in an article about science fiction, and it's always seemed a very science fictional type of word — like anti-matter, or anti-gravity. Science fiction has its share of one-dimensional white hats, but the characters who capture our imagination are usually the morally blurred rascals, who have their own best interests at heart. You never quite know what an anti-hero will do next. Here's our guide to the roots of science fiction's greatest anti-heroes.
The "anti-hero" comes to science fiction from a variety of sources, including noir and Westerns... but she also has her own uniquely science fictional avatars, that spring out of science fiction's tradition of skepticism and social criticism. The anti-hero is where science fiction's pulpy roots meet its most intellectual aspirations. Plus, he/she totally rocks on ice.
My favorite noir hero is Dashiell Hammett's nameless Continental Op, who spends more time orchestrating convenient murders than he does investigating crimes. In the novel Red Harvest, the Op arrives in a town called Poisonville which is run by organized crime, and he systematically tricks the town's ruling gangsters into killing each other, first a few at a time and eventually in a full-on massacre. By the end, he's one of the few people left standing. In noir, nobody's morally pure.
The classic science fiction noir movie is Blade Runner, featuring Harrison Ford's hardboiled and conflicted cop, who's hunting the Replicants without being sure if he's doing the right thing. And of course Blade Runner is based on a Philip K. Dick's Do Androids Dream Of Electric Sheep?, and a lot of Dick's best work has a particularly noir flavor of pulpiness. Dick's protagonists are never sure if they're doing the right thing, and often are just out for themselves. That could be one reason why Dick is the author of choice for movie adaptations — his work is very close to a genre that movie people understand.
Another great science fiction noir author is Richard K. Morgan (no clue if the middle initial "K" is a requirement), whose first novel Altered Carbon is like a fusion of Chandler with Doctorow's Down And Out In The Magic Kingdom: hard-as-nails gumshoe Takeshi Lev Kovacs dies in a shootout, and then is restored from a backup and "resleeved" in a new body so he can investigate the murder of a rich guy (who's also been restored and "resleeved.") And then Kovacs promptly sleeps with the rich guy's wife.
And then of course, there's always Jim diGriz, hero of the Stainless Steel Rat novels, who starts out as an amoral trickster — before eventually devolving into a bit of a pussycat. And there's Gully Foyle, dubious hero of Alfred Bester's The Stars My Destination. (And Alfred Bester becomes the name of a morally gray psy-corps agent on Babylon 5, who becomes more of a sympathetic anti-hero in Gregory Keyes' novels.)