Nearly all species of fish have an organ called swim bladder. The average body density of the fish body is slightly higher than that of water and it stays deep in water. When fish has to move up the gasses generated from the fish body fill the swim bladder and increases its volume. This makes the average density of the fish less than the density of water and the fish floats on water. Again when fish wants to move down it empties the swim bladder to required extent.