Oxygen is a byproduct of
photosynthesis
like carbon dioxide is a byproduct of animals.