While out on patrol, Batgirl (Barbara Gordon) fails to stop a robbery, but manages to stop one criminal with help from Batman. Paris Franz, the robbers' leader and the nephew of a powerful mob boss, develops a dangerous obsession with her and starts sending her messages. After Franz tricks her into finding his uncle's dead body, Batman becomes concerned about her safety and takes her off the case, telling her that she will eventually be tempted to kill the criminals she pursues. Outraged, Batgirl attacks Batman physically and verbally, which leads to the both of them having sex. A few nights later, Batgirl tries to apologize to Batman, but he is ambushed by Franz and his men, prompting her to come to his aid. When she arrives and overpowers Franz, he makes her lose control and give him a savage beating, stopping just short of killing him. Realizing Batman was right, she retires from crime-fighting.
Later, Batman investigates a murder scene with Detective Harvey Bullock and concludes that the Joker, currently held at Arkham Asylum, might be behind the crime. He goes to Arkham to talk to him, only to discover that he has escaped and put a decoy in his place. Joker then attacks Barbara and her father, Commissioner James Gordon. He shoots her in the stomach, paralyzing her from the waist down, and takes Gordon to an abandoned amusement park. There, Joker strips him naked and subjects him to torture, including showing him photos he took of Barbara, naked and in pain.
The story is intercut with flashbacks of Joker's origin. It is revealed that he was once a lab technician who quit his job to become a stand-up comedian, only to fail miserably. Desperate to support his pregnant wife Jeannie, he agrees to help two criminals rob his former workplace. The criminals tell him that he has to use the Red Hood's mask and caped costume, secretly intending to frame him. During the planning, the police inform him that Jeannie and their unborn child have died in a household accident. Grief-stricken, he tries to withdraw from the plan, but the criminals strong-arm him into keeping his commitment to them.
At the plant, the criminals and the costumed comedian run into security personnel, and a shootout occurs. The criminals are gunned down and the comedian is confronted by Batman. Terrified, the comedian trips and falls into the chemical plant's waste pond, and is swept through a pipe leading to the outside. As he removes his mask, he sees the chemicals have permanently disfigured his face, giving him a clown-like appearance. His disfigurement, combined with the loss of his family, drives him insane and transforms him into the Joker.
In the present, Batman finds and saves Gordon, while the Joker flees. Despite his ordeal, Gordon remains sane and demands that Batman capture the Joker "by the book". Batman follows the Joker as the latter tries to persuade him that the world is just one big joke, and that "one bad day" is enough to drive an ordinary man insane. Batman subdues Joker, tells him that Gordon has remained sane, and concludes that Joker is alone in his madness. He then attempts to reach out to him, offering rehabilitation. Joker declines, saying it is too late. He then says that the situation reminds him of a joke about two patients in an insane asylum who try to escape by leaping over to the adjoining building. The first patient makes it across, but the second patient is too afraid. The first patient says, "Hey, I got this flashlight with me. I'll shine it across the gap between the buildings and you can walk across the beam and join me." But the second patient says, "What do you think I am, crazy? You'll just turn it off when I'm halfway across!" Batman and Joker then have a good laugh at the joke as the police arrive. The Joker's laugh trails off while Batman continues to laugh, leaving the ending as ambiguous as the comic.
In a mid-credits scene, Barbara is in her wheelchair entering a secret room in her apartment. She says "back to work" as she turns on her computers.