The higher you go the faster you are, and the faster you are the higher you go. As your height increases, you have more potential energy. As you gain speed you have more kinetic energy. Swinging is caused by the conversion of potential energy to kinetic energy in a repeated cycle. As you reach the peak height of your swing, you will be experiencing the most gravitational potential energy, meaning that the swing wants to pull you back down.
Pumping your legs increases your potential energy. By raising your legs at each peak, you increase the height of your body’s center of mass, which makes you swing higher.
Click here to learn about gravitational potential energy
Click here for a simple explanation of swinging physics