After its defeat in WWI, according to the Treaty of Versailles, Germany was not allowed to have any submarines. In 1935, Germany ignored it and began to rebuild a new submarine force, under the command of a former World War I U-boat captain, Karl Doenitz. Doenitz advanced submarine warfare to new heights, trained highly skilled crews and captains, and developed devastating new tactics, mainly the Wolfpack tactic which allowed a group of submarines to efficiently coordinate and concentrate their effort instead of fighting alone.
In the Wolfpack tactic, the submarines first spread across a long stretch of ocean to enhance their probability of detecting passing enemy ships, and when one of the submarines detected a convoy of enemy ships, instead of immediately attacking it alone, it reported its position and course and followed it, and the other submarines first slowly regrouped to a position ahead of the enemy convoy, and only then attacked it together, preferably at night, overwhelming or even outnumbering the convoy's anti-submarine escort warships and sinking many more ships.
The devastating implementation of such tactics by the German U-boats, and systematic ongoing analysis of results and adaptation to changes, made Doenitz and his submarines the most formidable enemy Britain faced, more worrying even than the Luftwaffe. Winston Churchill said that the only threat that really worried him during World War 2 was "The U-boat peril".
The only thing that saved Britain from being suffocated early in the war by the German U-boats, were Doenitz's superiors.
1. The German High Command, and mainly Hitler, were focused before and during the war on continental ground warfare. Hitler was also firmly confident before the war that Germany will not have to fight Britain in the near future. He said so himself in a letter to the U-boat captains just 5 weeks before the war.
2. The German Navy itself, like the British Navy, was dominated by Admirals who served in the big guns surface ships, and despite the successful experience of German submarines in World War 1, and the development of the aircraft as a powerful weapon against surface ships, they kept the submarines force as a secondary arm of the Navy, in terms of budget allocation.
As a result, Hitler and Roeder (head of the German Navy) confidently rejected Doenitz' pre-war warnings that Germany has too few submarines to achieve their task of cutting Britain's maritime life line, and instead of having 300 submarines at the beginning of the war ( Doenitz calculated that considering the submarines sailing to and back from the area of operations, submarines used for training new crews, and submarines being resupplied and repaired in German harbors, he needed 300 submarines in order to have 100 submarines active in the area of operations near Britain.) as he wanted, he had just 55, and only 12 could be active in Atlantic operations.
Even after the war started, it took a long time before the U-boats were allowed to fully exploit their devastating potential and before their rate of production was significantly raised to compensate for losses and increase their numbers. In 1943 Doenitz was also promoted to head of the German Navy and submarine production was dramatically increased, but it was too late. The German U-boats then faced much stronger anti submarine forces, which were equipped with new technologies, new tactics, a new commander, Admiral Max Horton, a former submarine captain and commander of the British submarine force, who knew best how to fight against submarines, and by then merchant ships were produced in America faster than the U-boats could sink them. In May 1943 Doenitz lost 41 U-boats in 3 weeks. The hunters became the hunted. The U-boat activity expanded to the South Atlantic, to the US East coast, the Caribbean, and the Mediterranean, but the main battlefield remained the North Atlantic sea routes to Britain, and there they lost the battle.
Until the end of 1942, the Germans sunk an average of 14 ships for each submarine lost. Since 1943, the rate dramatically reduced and submarines losses were very high. During the war they sunk a total of 3000 allied ships, mostly merchants, 14.5 million tons of shipping, and lost almost 800 submarines, which is about 80% of those which participated in operations, and 2/3 of the total of 1170 U-boats produced