Matthew McConaughey is second in command on Bill Paxton's US submarine. He really wants a sub of his own and has just been turned down for one since Paxton just doesn't think he's ready yet. On the night of one of their crewman's wedding they get an emergency mission.
A german sub, the U-571 has been damaged in the Atlantic and has called for a rescue ship to bring mechanics, food, and enough equipment to get it going. The U-571 has on it, as all german U boats do, the enigma code machine. The US needs this so they can decipher the German codes thereby changing the balance of the Atlantic war.
The Americans decide to disguise their boat as a German sub, board the U571 as German mechanics, capture the germans and the enigma, then sink the U-571 so when the rescue ship arrives, it will have assumed that the sub was damaged so badly, it sank.
McConaughey, Harvey Keitel and a few other members of Paxton's crew board the U-571. All goes well as they capture the crew and the enigma. Just as McConaughey, Keitel and a few others are about to set the charges to blow the ship up, another German U boat (probably the rescue boat) arrives and blows up and sinks Paxton's boat.
McConaughey and the few crew members he has left, get inside the U-571 figure out some of the controls, (one of his crew can speak and read German) and then torpedo and sink the German rescue ship.
They resurface to see if there are any survivors from Paxton's sub. They find one of their men and a german seaman. The German seaman turns out to be the Captain of the U-571 but they don't know that.
They spend the next day or so trying to repair the sub with good old american ingenuity and actually get it going. They only have one torpedo left.
As they are heading towards allied territory they encounter a German destroyer. The Germans of course think that it is the U-571 and send a rescue ship to come board it. McConaughey knows they will be found out once they board so he orders his men to blow up the destroyers radio tower so the Germans can't tell anyone what's going on.
McConaughey then orders the sub to go down to 150 meters which is almost unheard of, especially for a sub in such poor condition. Keitel, acting a little like Scotty from Star Trek, tells him that the ship can't handle it and will be crushed. The destroyer drops depth charges and nearly destroys the sub. For some reason, the Germans don't stop and keep dropping the charges. Turns out that the German Captain on board is tapping their position off the side of the sub in morse code to the German destroyer.
They now go down to 200 meters and the charges stop. They position their one remaining torpedo and attack the destroyer blowing it up in spectacular fashion.
There is not much left of the U571 so they surface and get on a life raft. A US plane comes to rescue them and the enigma machine.
Quickie Spoiled by The Movie Spoiler