The Earth is about 4.6 billion years old. About 3.8 billion years ago there was no oxygen in the "atmosphere" which then was composed of carbon dioxide, ammonia, hydrogen, and methane. It was during this period when the first organisms appeared.
From about 360 to 299 million years ago, during the Carboniferous Period, one of the last periods of the Paleozoic Era, the climate was more tropical, humid and uniform than today. Then much of the Earth was covered with subtropical forests and swamps that were filled with plant life consising of ferns, trees, club moss growing up to 30 metres, and large leafy plants.
The oceans during this period were filled near the surface with phytoplankton and green algae. The greenness of many of these organisms was due to the green-colored pigment chlorophyll they contained. The chlorophyll was used by the organisms in a photosynthesis process, with sunlight as the energy source, to separate the carbon and oxygen atoms of the carbon dioxide (CO2) molecules they take in from the atmosphere. The separated carbon plus water, taken in by the organism, was used to produce various sugar forms for the organism's functioning. The separated oxygen was returned to the atmosphere as a waste by product.
Over long periods of time as plants died in the swamp forests on land, layer-by-layer their remains were buried in the Earth where they eventually turned into coal. The remains of dead phytoplankton and algae settled to the ocean floor where they also were buried and eventually turned into oil. Similar processes also produced natural gas. Coal, oil, and natural gas make up the fossil fuels.
For millions of years, these kinds of organisms have been filling the atmosphere with oxygen and sequestering carbon in the form of fossil fuels. This sequestering process has kept a large enough amount of carbon out of the atmosphere so that the Earth's green-house temperature has stayed below a temperature threshold for life as we know it to come into being and continue to exist to the present. The third thing they did was provide us with a convenient source of energy for humankind's industrial era.