A submarine (or Sub) is a vessel that goes under water. Submarines are often war vessels. Some are used for scientific or business purposes. People with a large amount of money can even buy their own small submarine to explore under the sea and look at fish. A submarine is always called 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 ship. This would often destroy the submarine as well.
Later, during the First and Second World Wars, better submarines were created. Many of these better submarines were created by Germany. 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 number of batteries while the submarine was above the water. This power was then used to power the submarine when it went underwater. These submarines were dangerous for enemies. They were hard to see while underwater but it was easy to attack them when they were above the water and recharging. They were only used to attack ships.
Most 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 use are attacking ships or launching rockets. These rockets include cruise missiles and nuclear missiles. There are two kinds of these subs. Attack subs are small and fast. They attack other subs and surface ships with a special kind of underwater bomb called a torpedo. Missiles subs are larger and slower. They are built to shoot missiles at far-away targets on land. Missile subs are usually big enough that they can carry commandos and launch them safely from their torpedo tubes.