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.
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.