Humans have managed to not only understand the phenomena of the natural world but to use them to their advantage to benefit society. Harnessing electricity and splitting atoms for energy are fine examples of advanced modern science in action, while the basic concept of buoyancy has been around for centuries, thanks to an ancient forward thinker named Archimedes.
Archimedes' explanation, later known as the principle of buoyancy, states that any craft (or person) in a body of water greater than its size feels an upward pushing force. This force is equal to the weight of the amount of water the craft displaces; if the craft displaces more water than its own weight, it floats (called "positive buoyancy"). If it displaces less water than its weight, it sinks ("negative buoyancy").
Boats and Ships
All boats, whether small fishing craft or massive steel freighters, feature large underbelly internal compartments made of air. Regardless of the construction material, when paired with air the craft is always less dense than water, thus allowing it to float. By contrast, a solid piece like a steel rod sinks in water. The principle is relative, which explains why huge craft would sink in smaller bodies of water--picture a frigate in a small, shallow pond.
Use the Force
Because of its chemistry of dissolved salts, salt water is considerably more dense than fresh water, which also explains why large craft can float with relative ease. The density also contributes greatly to the exerted upward force from the body of water, and this force increases dramatically at various depths. While ships may be able to float at the relative surface, in greater depths the pressure would exceed the boat's internal air pressure and the hull would get crushed. For example, consider an empty milk jug. It easily floats at the water's surface, but if pulled under at a great enough depth (around three to four feet), the jug would implode. An understanding and manipulation of this force is what permits submarines to submerge, travel, and surface repeatedly. Because of man-made ballast and trim tanks on the sub, water can be purged from the tanks and filled with air, which brings the sub to the surface and allows it to float. Once the tanks are flooded, the sub can dive.