The electrical energy we used is produced in power plants. These power plants convert fossil fuel, such as coal and diesel into electricity. The electrical energy produced is transported into where it is needed. Electricity also can be generated through natural sources such as Water (hydroelectric), Wind energy and Solar energy.
Electricity is produced using generators. The working principle of a generator is basically like below:
Magnet + Copper wire + Motion = Electricity
A generator has huge magnet that is turned by a turbine.
As the magnet turns inside a coil of wire, electricity is produced by electromagnetic induction. Many sources of energy are used to turn these turbines, each with its own advantages and disadvantages.