The transformation involves converting thermal energy into chemical energy. Sugar is rich in chemical potential energy, which explains why it serves as an energy source for living organisms. Photosynthesis utilizes sunlight to transform carbon dioxide and water into sugar and oxygen, effectively changing the thermal energy from light into the chemical energy stored in sugar.
I hope this clarifies things. If you have any questions, feel free to ask.