The common name given to the atmospheric gases used in breathing and photosynthesis is air. By volume, dry air contains 78.09% nitrogen, 20.95% oxygen, 0.93% argon, 0.039% carbon dioxide, and small amounts of other gases.

So why is the air mostly nitrogen? Many scientists believe that most of the nitrogen in our atmosphere was carried out from deep inside the earth by volcanoes. The nitrogen and oxygen molecules are heavier than most other molecules in the atmosphere, to they tend to settle towards the bottom of the atmosphere unlike lighter gases that tend to the top of the atmosphere where they are more likely to be lost in space.

Air also contains a variable amount of water vapour, on average around 1% at sea level, and 0.4% over the entire atmosphere. Air content and atmospheric pressure vary at different layers, and air suitable for use in photosynthesis by terrestrial plants and breathing of terrestrial animals is found only in Earth's troposphere and in artificial atmospheres.

More Info: en.wikipedia.org