When water (Hydro) falls down through the turbine blades of an electricity generator, the blades are made to spin. The blades are connected to a shaft, which is connected at the upper end to the armature of a large generator, which produces electricity.
Most, if not all, hydroelectricity is produced in tall dams on rivers. Examples include Hoover Dam in Nevada, and Grand Coulee Dam in Washington.
The electricity produced in dams is no different from electricity produced in other ways.
It is the generating electricity by conversion of the energy of running water.
Electromagnetism and gravity are both forces. They are two of the four fundamental forces. Also, hydroelectricity is generated by capturing falling water. Water, like everything else on Earth, falls because of gravitational force, so generation of electricity by this method is dependent upon gravity.