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 original master 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. The crew realizes that Wassner, despite being shackled, is using Morse Code to tap out a signal that the submarine had been captured, so they kill him. 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. 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 she slips beneath the waves taking her own master Kapitänleutnant Günther Wassner down with her once and for all. They are eventually spotted and rescued from their lifeboat by a US Navy PBY Catalina flying boat.