You swing on something that hangs freely from a pivot, say a branch of a tree. You use a pushing or pulling force to move the swing away from where it is hanging. When you do this, you add energy. When you stop pushing, the energy due to its height above when it was still gets changed into energy of movement. So you swing down in a curve. Then you swing up a bit the other way.
If you did nothing, friction would eventually turn all of the energy into heat and you would come to rest at the lowest point. However, by moving your body about (or getting someone else to push you) you give the swing more energy of movement and so you can make the swing go higher and higher.
If you move your body at the wrong time, your body movements will work against the pendulum effect, so you will come to a stop.