During the day plants photosynthesize to obtain energy and produce oxygen, the basic equation is this:
Carbon dioxide (CO2) + Light + Nutrients (in the case of aquatic plants) ----> Oxygen + Energy
Large, messy fish such as Goldfish will naturally consume aquatics plants as part of their diet. Therefore I wouldn't recommend that you mix live plants with these fish. However tough species such as Canadian pondweed (Egeria densa) can be used.
Live plants are beneficial to aquariums in many ways, they use up ammonia and nutrients such as nitrate and phosphate, which will in turn inhibit algae growth. They also provide shelter for fish and add to the overall look of the aquarium.