Solar panels convert sunlight into clean and green DC electricity. Inverter converts DC electricity into usable AC electricity.
One solar panel is made up of many small solar cells. Each of these cells uses light to make electrons move. The cell is made up of two different layers that are stuck together. The first layer is loaded with electrons, so the electrons are ready to jump from this layer to the second layer. That second layer has had some electrons taken away, so it is ready to take in more electrons.
When the light hits an electron in the first layer, the electron jumps to the second layer. That electron makes another electron move, which makes another electron move, and so on. It was the sunlight that started the flow of electrons, or electricity.