It's a familiar springtime tradition. For future spacefarers gardening will be a matter of survival. Not only will plants provide food when deliveries from Earth aren't possible, but plants will also work to make air breathable and water drinkable. Its life support systems are strictly mechanical so food must be ferried from Earth. Humans and planets are ideal space traveling companions.
Humans consume oxygen and release carbon dioxide.
Plants return the favor by consuming carbon dioxide and releasing oxygen. Plants and microbes can also work to purify water, possibly with help from machines. The only input needed to keep such a system going is energy in the form of light. This is a simplified portrayal, of course. For scientists and engineers who are trying to design a real system, the devil is in the details.