Things float in water if they are less dense than water, i.e. they weigh less than the same volume of water. The density of a human body with a lung full of air is about 0.985kg/l - slightly less than water (1.0kg/l) - which is why, if I throw you in a swimming pool, you'll float with a small amount of you (0.015 by weight out of the water). If you don't hold your breath because you panic or because you're dead, your weight remains the same, but your volume is smaller. Your density therefore increases to - about 1.08kg/l. This is higher than water so a dead body will actually sink.

At first.

Dead bodies start to decompose and this decomposition produces gas. Early production is in the gut and is trapped there, blowing the body up like a balloon. Weight won't have changed (much - there is a little change due to water absorption and predation) but volume increases as the body is inflated by an "internal life jacket" and eventually drops below 1.0 - and up the body will rise.
2 3 2
A person whem alive has density more than water so he/she Sinks.but when a person die and sink in the water,several gases are released in his/her body which makes the total density of the body less.Hence it floats on water.