This action-oriented crime thriller opens in a restaurant in Los Angeles, where a man discusses the 1975 film Dog Day Afternoon before walking off, with numerous SWAT officers pointing guns at him and a dishevelled man following him out. They walk to a nearby building with gunmen and hostages strapped with bombs and ball-bearings. One of the gunmen is killed by a sniper; when the hostage is forcibly taken away, the explosives detonate via a proximity trigger, killing her and others. The film then flashes back four days.
Stanley Jobson (Hugh Jackman) is a hacker who infected the FBI's Carnivore program with a potent computer virus, delaying its deployment by several years. For this, he was arrested by Agent J.T. Roberts (Don Cheadle), convicted of computer crimes and spent two years in Leavenworth.
A condition of his parole is that he is forbidden from touching, much less using, a computer. His ex-wife, Melissa (Drea de Matteo), has sole custody over their daughter Holly and a restraining order against Stanley from seeing Holly, despite her alcoholism, her job as a porn actress, and her marriage to her employer.
While Stanley is at home (a trailer in rural Texas) practicing his golf swing, Ginger Knowles (Halle Berry) shows up to solicit his hacking skills for her boss Gabriel Shear (John Travolta). Stanley is apparently recruited at the last minute as a replacement for Gabriel's first choice, Axl Torvalds (Rudolf Martin), a Finnish hacker of exceptional talent who was arrested by authorities at the airport. Torvalds is later assassinated by Gabriel's men before he can divulge anything about his assignment and who hired him to Agent Roberts.
For an initial $100,000, Stanley agrees to meet with Gabriel. He and Ginger fly to Los Angeles and meet Gabriel in a night club. Gabriel pressures Stanley right then and there to hack a government system in 60 seconds while simultaneously being held at gunpoint by Gabriel's bodyguard and right-hand man, Marco (Vinnie Jones) and receiving fellatio from a young woman (Laura Lane). Stanley manages to succeed in hacking the system, passing Gabriel's test.
Roberts realizes that Stanley was recruited to replace Torvalds, and begins surveying him, watching as he picks Holly up from school (Melissa being unconscious in an alcoholic stupor at the time) and drives her home. Confronting him afterwards, Stanley attacks Roberts and attempts to escape, only for one of Roberts's subordinates to hit him with his car. However, Roberts then says that he won't arrest him for visiting Holly, as he is more interested in Gabriel, who has a disturbing amount of resources and no traceable past. When Stanley confronts Ginger, she admits that she's undercover from DEA.
At his house Gabriel offers Stanley $10 million to write a worm, actually a "hydra" or as Ginger calls it: a multi-headed worm" that steals money from a secret government slush fund to the order of $9.5 billion. Gabriel reveals to Stanley that he works for an organization called the Black Cell that was started by J. Edgar Hoover in the 1950s, which is responsible for retaliatory attacks against terrorists who have attacked Americans. It is currently headed by Senator Reisman (Sam Shepard), who discovers that the FBI has caught onto Gabriel and attempts to pull the plug.
After Gabriel refuses to terminate his plans, Reisman attempts to have Gabriel killed, which fails. Gabriel tracks the Senator down while he is fly fishing in Bend, Oregon and kills him. Afterwards, he kills Melissa and her new boyfriend, then kidnaps Holly.
Stanley and Roberts confront Gabriel, who talks about Dog Day Afternoon. Gabriel proceeds with his plan and raids the local branch of the WorldBanc. In the process, he takes hostages, puts explosives on them and deploys Stanley's hydra. Having realized that Ginger is from DEA, Gabriel threatens to kill Ginger if Stanley doesn't deploy the hydra. Stanley deploys the hydra, but Ginger is killed anyway.
After stealing the $9.5 billion he boards the hostages and his crew on a bus out of the WorldBanc. Gabriel demands a plane at the local airport (a hostage negotiation cliché) but it was a diversion. An S-64 Aircrane swoops down, lifts the bus and releases it on the rooftop of a skyscraper. From the rooftop, Gabriel seemingly departs with his team in a helicopter, which Stanley shoots down with a rocket-propelled grenade. At the morgue, Stanley and Agent Roberts learn that the body recovered from the helicopter is that of a former Mossad agent named Gabriel Shear (possibly a mocked up dummy as Stanley saw the double in the "freezer" at Gabriel's house).
Stanley recognizes this corpse from "Gabriel's" house. Stanley realizes that DEA has no record of anyone named Ginger. DEA also does not have a picture of Ginger. Ginger's corpse is actually missing. After realizing that Ginger was wearing a bullet-proof jacket, Stanley realizes that Ginger and (imposter Gabriel) were partners in crime all along, making the entire operation a misdirection. Despite this, Stanley doesn't tell Roberts or the rest of the police that (Ginger and imposter Gabriel) are still alive. Roberts releases Stanley from prison, allowing him to have full custody of Holly.
Ginger and Gabriel are next seen in Monte Carlo transferring the $9.5 billion into other accounts. Finally, while Ginger and Gabriel look on, a yacht is destroyed as a news anchor is heard reporting that a suspected terrorist died on the yacht, the third such successful counter-terrorism operation in as many weeks.