During the Battle of the Atlantic, after sinking a merchant ship from an Allied convoy, German U-boat U-571 has her engines badly damaged by depth charges from a British destroyer. U-571's skipper Kapitänleutnant Günther Wassner makes a distress call that is intercepted by American intelligence. The US Navy has its submarine S-33 modified to resemble a German resupply U-boat, to try to steal the Enigma machine coding device and sink the U-571. Before the crew of S-33 receives its assignment, the submarine's executive officer Lieutenant Tyler is unhappy about a recommendation for command of his own submarine being blocked by his commanding officer, Lieutenant Commander Dahlgren.
During a storm, S-33's boarding party surprises and overwhelms the crew of U-571. After securing U-571, the American S-33 is torpedoed by the arriving German resupply submarine. Dahlgren is blown off the deck and seriously wounded; while struggling in the sea he refuses rescue and orders the boarding party on the captured U-boat immediately to submerge. Tyler takes command of U-571 and dives below the surface, where they subsequently engage and sink the resupply submarine.
After making repairs and restoring its power, Tyler decides to route the disabled submarine toward Land's End in Cornwall. However, they are spotted by a German reconnaissance plane, which is unaware that U-571 has been commandeered by Americans. A nearby German destroyer sends over some crew, but before they arrive, Tyler gives orders to fire a shot from the deck gun, which destroys the ship's radio room, preventing it from reporting the situation and revealing that the Allies have the Enigma. The submarine then dives beneath the German destroyer, which begins to drop depth charges. U-571's Kapitänleutnant Wassner escapes captivity, and kills one of Tyler's crew, but he is subdued before he can sabotage the engines.
Tyler attempts to deceive the destroyer into stopping its attack, by ejecting debris and a dead crew member out of a torpedo tube, faking their own destruction. However, the destroyer continues to drop depth charges. U-571 drops below 600 feet (180 m), and is damaged by high water pressure. They start to sink, and can only reverse this by ascending uncontrollably. Tyler orders crewman Trigger to submerge himself in the bilge underwater to repressurize the single remaining torpedo tube.
Trigger uses an air hose to breathe inside the flooded compartment. He closes the air valve to the stern tube, but finds a second leak, which he can't reach. The crew realizes that Wassner, despite being shackled, is using Morse Code to tap out a signal that the submarine had been captured, so Hirsch kills him. U-571 surfaces heavily damaged and begins to flood, unable to fire its last torpedo. The pursuing destroyer fires with its main guns: the damage pins Trigger's leg, when he is beyond reach of the air hose. Unable to turn back, he manages to close the valve before he drowns. Tyler orders Tank to fire the torpedo; the destroyer is unable to take evasive action and is sunk. As the crew sigh in relief, Tank reports Trigger's death. However, the submarine has taken severe damage, and so the crew abandons it with the Enigma in their possession. They watch U-571 as it slips beneath the waves once and for all. They are eventually spotted and rescued from their lifeboat by a US Navy PBY Catalina flying boat.
HMS Bulldog capturing U-110 and its Enigma machine, 9 May 1941 The film does not portray a historical event. The British Royal Navy had captured the first naval Enigma machine in May 1941, before the US had entered the war. The American portrayal offended many of the British military and public. The Allies captured Enigma-related codebooks and machines about fifteen times during the War; all but two of these by British forces. The Royal Canadian Navy captured U-744 in March 1944 and the U.S. Navy seized U-505 in June 1944. By this time, the Allies were already routinely decoding German naval Enigma traffic.
On the film's release, Labour MP Brian Jenkins, used Prime Minister's Questions in June 2000, to claim that the film was an "affront to the memories of the British sailors who lost their lives on this action." Prime Minister Tony Blair said, "I agree entirely with what you say...we hope that people realise these are people that, in many cases sacrificed their lives in order that this country remained free." Paul Truswell, MP for the constituency of Pudsey, a town closely associated with HMS Aubrietia, wrote to the U.S. president, Bill Clinton who acknowledged that the film's plot was only a work of fiction. The director of the local Hosworth Museum lamented the rewriting of history, saying: "You can't rewrite history and we have to pass on the facts to the younger generation through the schools."
The first capture of a naval Enigma machine with its cipher keys from a U-boat was made on 9 May 1941 by HMS Bulldog of the Royal Navy, commanded by Captain Joe Baker-Cresswell assisted by HMS Aubrietia. The U-boat was U-110. In 1942, the Royal Navy also seized U-559, capturing additional Enigma codebooks. According to Britain's Channel 4, "the captured codebooks provided vital assistance to British cryptographers such as Alan Turing, at the code-breaking facility of Bletchley Park, near Milton Keynes."
The United State's involvement in the European Theatre of the Second World War did not commence until mid-1941 with Lend-Lease, and direct, open participation did not begin until the U.S. Navy began engaging the Kriegsmarine in the fall of 1941, months before Pearl Harbor, by which time Enigma machines had already been captured and their codes broken in Europe. An earlier military Enigma had been examined by Polish Intelligence in 1928; the Polish Cipher Bureau broke the Enigma code in 1932 and gave their findings to Britain and France in 1939, just before the German invasion of Poland.
Sub Lt. David Balme, the Royal Navy officer who led the boarding party on U-110, called U-571, "a great film" and said that it would not have been financially viable without being "americanised". The film's producers did not agree to his request for a statement that it was a work of fiction, but the end credits dedicate the film to the "Allied sailors and officers who risked their lives capturing Enigma materials" during the Second World War. The credits acknowledge the Royal Navy's role in capturing Enigma machines and code documents from U-110, U-559 and the U.S. Navy's capture of U-505.
In 2006, screenwriter David Ayer admitted that U-571 had distorted history, and said that he would not do it again. He told BBC Radio 4's The Film Programme that he "did not feel good" about suggesting that Americans, rather than the British, had captured the naval Enigma cipher: "It was a distortion...a mercenary decision...to create this parallel history in order to drive the film for an American audience. Both my grandparents were officers in the Second World War, and I would be personally offended if somebody distorted their achievements."