
A submarine is any boat that can sink to avoid being attacked. They can also stay on the surface for a while to run their diesel engine and recharge their batteries.
Type 21 u-boat, or type xxi is a submarine that was used by the German navy during World War II. They were a significant improvement on earlier German submarines.
They were able stay underwater longer than their predecessors and submerged more frequently. Schnorchel, a new technology that allows for submergence, was what they used.

This breakthrough technology was a big step forward in the world submarines. It was a revolutionary change in how submarines were built and how they worked. The Schnorchel, a compact and small engine, could be installed inside an existing U boat's hull. This would allow it submerge for much longer times than previous designs. Also, the engine could reload torpedoes aboard while underwater.
This technology was a breakthrough and allowed the Germans construct larger, more powerful submarines capable of enduring more attacks. This enabled them be able keep their crews afloat and to fight longer, which ultimately helped them win war.
The Schnorchel's most significant feature was its ability to recharge their torpedoes under water. This was a huge advantage for the Germans. It meant they didn't have to worry about reloading their torpedoes as often, which in turn allowed them to spend more time in the water hunting for enemy ships.
Type XXI was the first U-boat to be built in Germany during World War II. It was meant to be the submarine that the Germans could use for victory. However, it was also a significant failure that may have helped the Third Reich to defeat.

A few years ago, the Germans started working on a revolutionary new submarine design. But it was a gamble, and they weren't ready to take that risk. They weren't sure the new boat would be able to perform well, and they didn't want to have to risk a lot of money on something that may not even work.
But, they were able get a prototype manufactured in April 1944. This gave them hope that production would be started sooner. The new design was based on the same Walter gas turbines that were used in the original designs, but doubled by the new Deutz SAA SM517 supercharged 8-cylinder diesel engines. These engines, combined to the streamlining of the hull, enabled seventeen knots of submergence.
The gamble was a massive one for the Germans and Donitz had to make a difficult decision between giving up submarine warfare completely or gambling on the new design. He knew that the war would end if he did not have this boat. He also knew that the new boat could do more than simply reload torpedoes, which was a major plus.