Nitrogen now makes up most of the atmosphere, but in the Earth' searly atmosphere, carbon dioxide made up most of it.
This is the diagram which shows how photosynthesis.
It shows Sunlight + Water + Carbon Dioxide → Oxygen
The high concentration of oxygen that plants had been producing for a long time created the present atmosphere in which a variety of animals can live.