From our point of view, the most important thing about air is that it is one-fifth oxygen. We need oxygen to breathe. However, the majority of the air is made of a gas called nitrogen. After that there is a gas called water vapour (part of the water cycle), carbon dioxide (that we breathe out or is produced by burning fuels) and many other gasesin very small proportions.
Trees release oxygen when they use energy from sunlight to make glucose from carbon dioxide and water. Like all plants, trees also use oxygen when they split glucose back down to release energy to power their metabolisms. But on average they produce more oxygen than they use up.
Of course, trees are not the only plants in the world, and most of the oxygen is released by plants like algae in the oceans. Every animal also uses oxygen, so they take their share from the air, too. But without the trees and other plants on land and in the sea, all animals would soon use up the oxygen in the air and die. Now you know the importance of plants to the air.