https://en.wikipedia.org/wiki/Stromatolite
A long time ago the world was different and harsh. Clusters of bacteria lived in the ocean in protective mounds and their byproduct was oxygen. The oceans were full of iron and became rusted. After the ocean waters saturated with oxygen, the atmosphere began becoming oxygenated. Thus complex lung breathers came into existence.
(Info from
NOVA | Australia: First 4 Billion Years)