When good eggs go bad.
Or sometimes they do this instead.
A bad egg will float in water. Not only has the air pocket inside become larger, the breakdown of the contents produce gas that also gives you the olfactory warning of an eggs badness.
According to Harold McGee, author of On Food & Cooking (Canada, UK), Hannah Glass gave this practical advice to cooks around 1750, and it’s as valid today — a “way to know a good egg, is to put the egg into a pan of cold water; the fresher the egg, the sooner is will fall to the bottom; if rotten, it will swim at the top.”