Solar panels are made predominantly of an element called Silicon- the same element that makes up sand and glass. However, a special type is used in solar panels- half of which is doped with Boron, making one side positive, and half of which is doped with Phosphorus- making the other side negative.
When light falls onto the panel, a voltage is generated between the two layers. This voltage is solar electricity which can then used to power your home or be sold back to the National grid if you’re producing more than you need at any point in time.