The depletion region frees charge carriers when light is incident on it. Due to the internal electric field set up by the depletion region(immobile ions) the charge carriers start to move and hence current flow. The current flow triggered by light , hence it is a solar cell. It is not thermal energy as solar cell doesn't work well at high temperature. You find that the solar cell are more efficient in Canada where it is cold.