The chemical rearrangements and changes that occur during photosynthesis are what have allowed most of the life forms on Earth to evolve. The basic equation for photosynthesis
6CO2 + 6H20 -----(light energy)---->C6H12O6 + 6O2
shows, in short hand form, that carbon, hydrogen and oxygen in the presence of light energy change in form from molecules of carbon dioxide plus water to glucose plus oxygen.
As you can see from the formula above, the process begins with carbon and oxygen atoms bound together, as well as hydrogen with carbon. The 6-carbon sugar, glucose, that is formed from carbon, hydrogen, and oxygen represents a molecule that stores chemical energy that is then utilized by the plant, and any organism that happens to consume it. That, along with the free oxygen that is released, are the starting molecules for cellular respiration. The chemicals are again rearranged in this "reverse" equation to photosynthesis, releasing the stored energy for the organism in which it occurs. There are many intermediary steps in both processes, in which the chemicals are rearranged multiple times before becoming the final products.