In most cases when organisms die, their bodies decompose and become lost.
But every once in a while, the body or at least some parts of the body may be in an environment that does not decompose completely.
It is through such preserved traces of living organisms that we get fossils.
For example: If a dead insect gets caught in hot mud, it will not decompose quickly, the mud will eventually harden and retain the impression of the body parts of the insect.