Buckle up, this is going to get a bit nerdy.
Essentially, solar panels allow photons (or sunlight) to knock electrons free from atoms, which generates an electrical charge.
This happens when sunlight passes through a few layers of silicon (think of it like a sandwich) - which are found in solar panels.
The top layer of silicon will have phosperous mixed into it to give it more electrons, which gives it a negative charge.
The bottom layer of silicon will contain boron to produces fewer electrons, which gives it a positive charge.
The positive and negative charges create an electric field in the middle layer.
When sunlight hits this electric field, photons knock the electrons from the field and send them to wires on the edge of panels. The wires feed to an inverter which then turns thes electrons into a form of electricity which powers your home.