No one invented energy! Energy is the capacity to do work and is involved when things happen. Think of any possible event you can - energy will be involved. read more
Actually the mechanical energy of the system is diminished at the end of each swing by the tiny amount of energy transferred out of the system by the work done by the pendulum in opposition to the forces of friction and air resistance. read more