Dating back to the precambrian era
During this era, one type of organism, the Cyanobacteria (blue-green algae) produced oxygen as a metabolic by-product; the eventual build-up of this highly reactive gas was to eventually prove fatal to many life-forms, and converted the atmosphere from.
The Proterozoic, which lasted even longer than the Archean Era, saw the atmosphere changes from reducing to oxygenated, driving the original anaerobic inhabitants of the Earth into a few restricted anoxic refuges and enabling the rise of aerobic life (both prokaryote and the more complex eukaryotic cell, which requires the high octane boost that oxygen enables.) Stromatolites (colonial cyanobacteria), which had appeared during the Archean, were common.
These divisions are pretty arbitrary, like all such man-made classifications, but they at least can serve as useful labels, so we can orientate ourselves in our journeys through deep time.
So the Paleozoic, the era of "ancient life" is characterized by fossils of invertebrates, primitive tetrapods, etc; the Mesozoic or era of "middle life", by fossils of dinosaurs etc, and the Cenozoic or era of "recent life" by mammals and modern plants and invertebrates.
(more on these subdivisions) We know these intervals lasted for millions of years, or even tens or hundreds of millions, because they can be dated them with a fair degree of accuracy according to the amount of radioactivity that occurs in the rocks.
Gradually the molten Earth cools, outgassing of first atmosphere and oceans, bombardment by left-over planetesimal and debris.
These eras are divided into periods, the system of which was established by the middle of the last century.