The gas that makes up about 21 percent of the atmosphere is oxygen. The atmosphere surrounding the Earth is not the same as it once was, as oxygen was not nearly as abundant.
The first free oxygen on Earth probably came from sunlight interacting with the water vapor coming from volcanoes. About 2.7 billion years ago, organisms called the cyanobacteria appeared on Earth. The cyanobacteria, along with algae, produced free oxygen as a byproduct of photosynthesis.
At first, the oxygen levels in the atmosphere did not change significantly because much of the oxygen produced was absorbed by rocks. When the rocks were sufficiently oxidized, the surplus oxygen was free to accumulate in the atmosphere. The current level of oxygen in the atmosphere came about approximately 400 million years ago.