HST does have batteries, but as we all know, batteries quickly run low and need to be recharged. So Hubble also has two large solar panels that generate electricity from sunlight. On each panel, there are thousands of tiny solar cells.
Solar cells are photovoltaic devices.
They are made of semi-conductor material that is sensitive to light. When the Sun's photons strike Hubble's panels, their energy is transferred to the electrons around the atoms that make up the solar cell. The electrons in the solar cell become energized and can escape from their normal positions around the atoms in the solar cell. Once they escape, they are free to become part of an electrical current. When individual solar cells are connected together in giant circuits, like they are in the solar panels, they can generate enough electrical power to run the Hubble Telescope and recharge its batteries.