In simple terms, the energy comes from combining food in our bodies with the air we breath. And plants do exactly the same thing. For respiration of both humans and plants the important part of the air is oxygen. The other important gas in the air is carbon dioxide. During respiration our bodies produce carbon dioxide.
Plants do the same thing.
The plant gets its water, and water for the vegetable, from the ground via the roots. Usually the cut vegetable will never contain more water than it does at harvest. The quality, firmness, freshness and crispness of vegetables depends in large part on the amount of water in them. To look good, vegetables must contain as much water as possible. This means that every effort should be made to keep water in the vegetables after they're harvested.