From the moment you leave the pet store with the little fish in its water-filled bag, you dread the inevitable moment when your sobbing child will clutch you and whimper, "Nemo is floating on top of the water!" We'll leave the cosmic explanations to you, but we can help explain the physical phenomenon.
Fish are slightly more dense than the water in which they swim. They are almost neutrally buoyant, meaning the forces acting against the fish to make it sink are about equal to the forces inside the fish causing it to float. It also means fish don't have to work too hard to keep from floating or sinking.
Pressure increases with water depth. Most species of fish counteract fluctuations by using an internal pouch called a swim bladder (also called the gas bladder or air bladder). Water enters a fish's mouth and passes through gills, where oxygen is extracted and carried by hemoglobin through the bloodstream. Hemoglobin releases some of that oxygen into the swim bladder.
The amount of oxygen in the bladder determines the fish's buoyancy. If Nemo begins to dip, oxygen is absorbed into the bladder. If he floats too much, gas diffuses into the blood and out the gills. Mark Boriek, a biologist with the New Jersey Department of Fish and Wildlife explains that the process "isn't a conscious effort on the part of the fish, but rather a chemical response to the pressure surrounding the fish."
Oxygen remains in the bladder after a fish dies. Additional gases are released during decomposition. "The fish is like a closed container," says Boriek. "As the fish decomposes, gases fill the body cavity." The belly becomes a guts-filled balloon and the fish floats to the surface. Most of a fish's mass is bone and muscle on its dorsal side, so as the belly balloon rises, fish tend to flip upside down.
Fish don't always float to the surface right away. They may sit on the bottom for a while until the gases build.