To increase his and the East India Trading Company’s power in the Caribbean, Lord Cutler Beckett executes anyone, including women and children, suspected of or remotely associated with piracy. Beckett, who now possesses Davy Jones’s heart, orders Jones to destroy all pirate ships. Condemned prisoners defiantly sing a song to summon the nine pirate lords comprising the (fourth) Brethren Court to convene at Shipwreck Cove and take action against Beckett. However, Captain Jack Sparrow, pirate lord of the Caribbean, never appointed his successor, and therefore must attend. Captain Barbossa leads Will, Elizabeth, Tia Dalma and Black Pearl crewmen to rescue Jack. Sao Feng, pirate lord of the South China Sea and residing in Singapore, possesses a map to World’s End, the gateway to Davy Jones’ Locker, where Jack is eternally imprisoned. Elizabeth and Barbossa bargain with Feng for the map and a ship, but Feng is furious that Will already attempted to steal it. The British Royal Navy, led by Mercer, acting under orders from Beckett, make a surprise attack on Feng’s bathhouse. During the ensuing chaos, Will strikes a bargain with Feng for the Black Pearl in exchange for Sparrow, who Feng wants to turn over to Beckett, presumably for immunity from Davy Jones’ attacks on pirates. Will wants the Black Pearl to rescue his father from The Flying Dutchman.

The crew journey through a frozen sea and sail over an enormous waterfall into the Locker. Sparrow, trapped aboard the Pearl, constantly hallucinates about an entire crew comprising himself, each representing a different facet of his character. When the Pearl is mysteriously carried to an ocean shore by crab-like creatures (presumably sent by Tia Dalma, since she is seen stroking a crab as the ship moves), Jack is reunited with his old shipmates. He is initially reluctant to rejoin a crew which includes the four people who once attempted to kill him, with one (Elizabeth) succeeding. As the Black Pearl crew seek an escape route, dead souls are seen floating by underwater. Tia Dalma reveals that Davy Jones was appointed by Calypso, Goddess of the Sea and his lover, to ferry the dead to the next world. In return, Jones was allowed to step upon land for one day every ten years to be with his love; but when she failed to meet him, the scorned captain abandoned his duty and transformed into a monster. Elizabeth sees her father, Governor Weatherby Swann’s soul pass by in a boat, murdered by Cutler Beckett after Swann became suspicious about the heart. Swann reveals that whoever stabs Jones’ heart becomes the Flying Dutchman’s immortal captain. A distraught Elizabeth vows revenge.

The Black Pearl remains trapped in the Locker until Sparrow deciphers a clue on the map, realizing the ship must be capsized to return to the living world. The ship is overturned at sunset and upturns back into the living world as the sun rises; a green flash marks their return. The crew stop at a small island to restock supplies, they find the carcass of the Kraken (the beast having been killed by Jones on Beckett’s orders), where Jack realises just how serious the threat to piracy’s existence truly is. Further in, they are ambushed by Sao Feng, who reveals his secret agreement with Will. However, he betrays Will, having made another deal with Cutler Beckett to hand over the crew and keep the Black Pearl. The Endeavor arrives, and Sparrow is taken aboard, although he refuses to divulge to Beckett where the Brethren Court will convene: instead, Jack manufactures a deal to lead Beckett to where the pirates will convene and lure them out for Beckett to destroy, in exchange for Beckett protecting him from Jones. When Feng is double-crossed by Beckett, Feng bargains with Barbossa to release the Pearl in exchange for Elizabeth, who he believes is Calypso trapped in human form. Feng attacks the Endeavor, allowing Jack to escape. Aboard his warship, the Empress, Feng tells Elizabeth that the first Brethren Court trapped Calypso into human form so men could rule the seas. Davy Jones attacks Feng’s ship. The mortally wounded Feng appoints Elizabeth as the new captain and the Pirate Lord of the South China Sea. She and the crew are then imprisoned in the Flying Dutchman’s brig. Also aboard is Admiral James Norrington, who frees Elizabeth and her crew after regretting his prior actions. They escape to their ship, although Norrington is killed by Will’s deranged father, “Bootstrap” Bill after discovering Norrington aiding Elizabeth and her crew’s escape.

Will leaves a trail of floating corpses for Beckett’s ship to follow. Jack catches Will and gives him his magical compass so Beckett can find Shipwreck Cove. Jack then tosses him overboard, but Will is rescued by Beckett’s ship, and it is revealed that Davy Jones masterminded Calypso’s imprisonment by the first pirate lords. At Shipwreck Island, the nine pirate lords introduce themselves and present the nine pieces of eight. When they are told the reason of the meeting, they disagree over freeing Calypso. Barbossa calls upon Captain Teague Sparrow, Keeper of the Pirata Codex, and Jack’s father, to confirm that only a Pirate King can declare war. Elizabeth, newly ordained Pirate Lord of the South China Sea, is elected Pirate King after Sparrows vote for her breaks a stalemate (each pirate lord only voted for themselves). She orders the pirates to go to war against Beckett. During a parley with Beckett and Jones, Elizabeth and Barbossa swap Sparrow for Will.

Barbossa tricks the other pirate lords into yielding their “pieces of eight” rank insignias, which he needs to free Calypso, who is bound in human form as Tia Dalma. As Barbossa releases her in a ritual, Will discloses that it was Davy Jones, her lover, who betrayed her to the Brethren Court. Her fury unleashes a violent maelstrom just as the Navy’s massive fleet appears on the horizon. During the battle, Sparrow escapes the Flying Dutchman’s brig and steals the Dead Man’s Chest. Meanwhile, Davy Jones kills Mercer and obtains the key to the chest, which Jack then steals from Jones during a duel. The Black Pearl and the Flying Dutchman face off near the center of the massive maelstrom. Will proposes to Elizabeth, and Captain Barbossa marries them in the midst of battle. Will boards the Flying Dutchman to retrieve the chest, but is mortally wounded by Davy Jones. As Bootstrap Bill attacks Jones, Sparrow, who wanted the heart for his own immortality, places his broken sabre in Will’s hand and helps him stab Jones’ heart, killing Jones. Jack and Elizabeth escape the Flying Dutchman as the crew carve out the dead Will’s heart and places it into the Dead Man’s Chest; the ship disappears into the whirlpool. Beckett, never intending to honor his agreement with Jack, moves to attack the Black Pearl. The Dutchman suddenly resurfaces from the depths, with Will as the captain and the crewmen now human. Will and Sparrow aim the Flying Dutchman and the Black Pearl at the Endeavour, destroying it and killing Beckett. The armada retreats in disarray.

Although Will has been saved and the Dutchman crew has regained their humanity, he is bound to sail the sea as the Dutchman’s captain. Will and Elizabeth have one day together where they consummate their marriage on an island. Will departs at sunset, but first gives Elizabeth the Dead Man’s Chest for safekeeping. Shortly after, Barbossa again commandeers the Black Pearl, stranding Jack and Gibbs in Tortuga. Having anticipated Barbossa’s deception, however, Sparrow has already removed the map’s middle that leads to the Fountain of Youth.

In a post-credits scene set ten years later, Elizabeth and her and Will’s nine-year old son stand atop a seacliff; a green flash fills the sky. The Flying Dutchman appears on the horizon with Will Turner aboard, sailing towards his family. In the DVD commentary, the screenwriters state that because Elizabeth remained faithful to Will for the interim 10 years, and he fulfilled his duty to ferry souls to the next world, he is freed from the Flying Dutchman. Though the “Pirates Secrets Revealed” leaflet insert in the DVD release says that Will is bound forever to the Flying Dutchman and may only step on land once every ten years, this may only be a misconception on Disney’s part.