How Do Solar Panels Work is explained here. To the average person, it is magic. However, the process is explained here so we can all know the method used.
A Solar Panel is made of up individual cells that capture the sun's rays due to the Photovoltaic Effect when the sun hits panels made from silicon, generating an electrical charge. That's the simple version of it! Silicon is actually a semiconductor. It will collect the sun rays through this "photovoltaic effect".
The process of generating solar electricity starts with solar cells, the individual pieces that make a larger solar panel. Solar cells are usually made from the element silicon (atomic #14 on the periodic table). Silicon is a nonmetal semiconductor that can absorb and convert sunlight into electricity – we also use silicon in almost every computer on the planet. There are a few different types of semiconductors typically used in solar cells, and silicon is by far the most common, used in 95% of solar cells manufactured today.
There are two layers of silicon used in photovoltaic cells, and each one is specially treated, to create an electric field at the junction between the layers. This electric field forces loose electrons to flow through the solar cell and out of the silicon junction, generating an electrical current. Phosphorus and boron are commonly used as positive and negative doping agents, respectively, to create the positive and negative sides to a photovoltaic cell.
The panel is designed to be heated up by the Sun, transfering the "current" they have just created, thru the layers of the panel and then send that "current" to a system of wires that will then be feed into an inverter.
This created "current" as actually Direct Current - DC - when it reaches the Inverter Device. The purpose of the Inverter is to change that DC Current to Alternating Current - AC - current so it may be used within our AC method of powering our devices and homes.