A living organism is a dynamic thing. Just about all parts of a body are constantly being remodeled — broken down and rebuilt — as an ongoing process. When an organism dies, the breakdown processes continue unopposed. Many of the common decomposition products from living tissue are gaseous, and it's these compounds we smell.
This answer was written by Dr. Steven Angel, MD, FRCPC, General Pathologist & Assistant Professor, University of Saskatchewan.