Solar panels contain photovoltaic (PV) cells. These are made from semiconductor materials that convert sunlight into direct current (DC) electricity.
An inverter then converts this to alternating current (AC) for use in your home.
Panels still generate electricity on cloudy days, just at a reduced output.