Thank you for your question on how solar panels works. We have a dedicated lesson on this which you can access here: https://www.stoplearn.com/courses/power-energy/off-grid-solar-installation-training-course-free/lessons/how-do-solar-panels-work/
You can also watch a Youtube video that explains how solar panel works here:
But basically, you have to understand that solar panels work by converting the light energy that falls on the panels into electricity. This light energy is known as photons or packets of energy. The panels are made with silicon materials that trap this photon and convert this energy into flowing electrons which when channeled properly becomes electric current.
Please feel free to ask any other question or to reply to this one below.