Fish swim by propelling themselves through the water in a wave-like fashion. Fish with streamlined bodies and crescent-shaped caudel fins move faster through the water by moving their tail from side to side - this moves them forward a lot like rowing a boat with an oar.
Fish also use their pectoral fins, which are situated horizontally on the body of fish who are fast swimmers. In combination with the pelvic fins, these help to stabilize the fish to keep it from rolling over as it moves through the water.
The pectoral fins are set almost vertically in slower swimming fish. These with the pelvic fins help the fish by acting as brakes. They can also assist the fish with difficult maneuvers. Take an hour to just watch your fish swimming and you will understand how they swim and why and you will start to see which kinds of aquariums are more conducive to a better and healthier way of life for your fish. In general, because of the way fish are put together (their anatomy) you can see that they generally swim horizontally. This is why a longer, rectangular aquarium is best to allow them to swim and maneuver freely.
Besides the obvious outer workings of the fish anatomy and how it allows the fish to swim, inside the fish has a swim bladder that is all important in swimming, too. The swim bladder is a flexible-walled gas-filled sac located in the dorsal portion of the body cavity. It controls the fish's buoyancy. If a fish starts to descend in the water, the increased pressure from the water surrounding the fish results in a compression of the gas inside the swim bladder and the fish will tend to sink. If a fish swims into shallower water, there is a decrease in water pressure and so the gas in the swim bladder expands and the fish tends to float upwards. Apparently, the swim bladder is of the upmost importance. This is one reason it is critical to keep the water clean - because dirty water is poisonous to your fish and can eventually weaken and destroy their swim bladder. This can lead to your fish's death.