As you observe in the image, both 02 and CO2 enters the plant and both are utilized by the plants as well in the process of respiration and photosynthesis respectively. Look at the reaction:
During Respiration O2 is utilized and CO2 is liberated out by the plant:
oxygen + glucose -> carbon dioxide + water + heat energy
During Photosynthesis CO2 is utilized and O2 is released:
carbon dioxide + water+ light energy -> oxygen + glucose
During photosynthesis, plants create their own food (glucose) whereas during respiration, plants consume glucose and convert it into energy which fuels the plants cellular activities.