Well, basically its a big circle of life- the earth began, with no life, and a huge chain of volcanoes. The volcanoes constantly produced CO2, or Carbon Dioxide. Plants create energy and food using carbon dioxide. This is called photosynthesis. The two things needed for photosynthesis are carbon dioxide and light. Oxygen is created in this process, and is then excreted. It is that same for trees. So, this is where oxygen comes from, and also a plant does 'breathe' or respire, so it also uses oxygen, but not much. Then, we humans use the oxygen they release.
Posted 4420 day ago