The outer surface of the photocells consists of a not reflective material that can be penetrated by the sun light. The light passes through this non-reflective material trapped inside and driven to the inner layers, where special absorbent materials exist. These materials absorb light.
The absorption of light causes some electrons of the absorbent material to switch from zero energy state of to an excited energy state. In this excited state the electrons are not related to specific atoms, but are freely moving electrons.
These freely moving electrons are forced by an electric field to move to a certain direction, thus creating electricity.