A human body with water in the lungs sinks. As the body decomposes, the bacteria in it develop gases that send the corpse back to the surface of the water.
If a person is drowning or a corpse is thrown into the water, the body will initially sink to the bottom like a brick.
That is because the body is heavier than water, and as the lungs fill up with water, the air that keeps the body afloat disappears.
Yet the dead often float on the water.
The explanation for this is provided by bacteria.
Bacteria form gas
The body contains billions of bacteria, and many of them live on in the dead body - even if it is under water, where there is little oxygen.
Now that the body's immune system is no longer active, the bacteria break down the soft body tissue and produce gases such as methane and ammonia. They mainly accumulate in the abdomen, which becomes bloated.
In a few days the body will contain so much gas that it rises to the surface like a balloon.
The body always basically floats with the back up, because arms, legs and head are heavier than the torso, and because they automatically turn to the front of the body, they will pull down that side.
Body can be gone in a month
For centuries, murderers have been trying to get rid of corpses by throwing them into the water, and many corpses are never found.
The cause of this may be that predators eat the corpse, which may have happened in a month according to a group of Canadian researchers.
It may also be that the corpse is weighted or that there is a hole in the head through which the gases can escape. In that case a corpse can stay under water forever.