The carbon dioxide and water are chemically combined with the chlorophyll in the plant to produce simple sugars. The sugars are converted to starch and oxygen is produced as the by-product. The light in your tank is most important with respect to the chlorophyll. The chlorophyll is what absorbs the light to create the process of photosynthesis. The plant naturally absorbs more nutrients through the roots during this time.
Respiration is the opposite of photosynthesis.
When the lights are out, the photosynthesis process ceases but the respiration continues. The plant will use oxygen to break down food substances, which is released as energy in the form of heat. Carbon dioxide is produced and expelled as a result of this process. So, when the lights are on the plants absorb carbon dioxide and expel oxygen. When the lights are out the plants absorb oxygen and expel carbon dioxide.