A submarine (or Sub) is a vessel that goes underwater. Most large submarines are war vessels. Some small ones are used for scientific or business purposes. These are often called "submersibles" and cannot go far or stay long away from base. Some people buy their own to explore under the sea. A submarine is actually a boat, not a ship.
In early times, submarines were often powered by hand. This is because boat engines had not been invented yet. They were almost always designed to be used for war. Submarines would try to sink enemy ships by crude methods. These included drilling screws into their wooden hulls. Some tried to blow up a ship. This often destroyed the submarine, too.
Later, during the First and Second World Wars, better submarines were made. Many of these better submarines were created by Nazi Germany, called U-boats. The submarines were powered by a diesel-electric system. A diesel motor would be used to turn a generator. The generator would charge a large battery while the submarine was on the surface. The power in the battery was then used by the submarine when it went underwater. These submarines were dangerous to enemies. They were hard to see while underwater but it was easy to attack them when they surfaced to recharge. Even many navies today still use this diesel-electric concept, but the boats in use today are larger and more modern.
The First Battle of the Atlantic was the first major battle that was mainly fought between submarines and their enemies. As in later wars, the main jobs of submarines were to enforce a blockade and to sink enemy warships. They usually attacked freighters at night, shooting with their deck guns and then hiding under the water. Sometimes they used their torpedoes, which they could fire while underwater, especially against larger ships and warships. During World War II The US Navy lost around 52 submarines due to combat and non combat causes.
After World War II better sonar helped the enemies of submarines to find and destroy them. New subs were more streamlined and had no deck guns because water dragging against the guns made noise underwater and slowed the subs.
Most large modern military submarines are powered by nuclear reactors. These submarines often have a system which can get air from the seawater. These two things allow them to stay under water for long periods of time. Their most important uses are attacking ships or launching missiles. These include cruise missiles and nuclear missiles. There are two main kinds of subs. Attack submarines are small and fast. They attack other subs and surface ships with torpedos. Missile subs are larger and slower. They are built to shoot missiles at far-away targets on land.