The plants produce oxygen through photosynthesis, this is essential to human and animals. We need oxygen for respiration. Hence, the plants restore and keep the balance of the concentration of oxygen gas in the air.
Furthermore, they synthesize their own food through photosynthesis, which is stored as sucrose. We consume them to gain energy released from the oxidation of glucose, which is obtainable when sucrose is broken down into glucose and fructose in our digestive system.