Why the work done by system not stored as potential energy?

For generalization work done on system is stored as potential energy but where is work done by system gone during the process?

The work done by the spring mass system takes the work done on the spring mass system and stores it as potential energy in the spring mass system. The net work done on the mass of the system is zero. The following is presented as an explanation.

When an external agent (for example you) applies a force to a mass on the end of a spring (let's assume the spring is horizontal so that gravity plays no role) it compresses the mass spring system. The force you apply to the mass is in the same direction as the displacement of the mass so you do positive work on the mass equal to $\frac{kx^2}{2}$.

At the same time the spring exerts a force on the massin a direction opposite the displacement of the mass. Therefore it does negative work taking the energy you provided to the mass and storing it as potential energy of the spring mass system. The net work done on the mass is zero, since by the work energy theorem the net work done on an object equals its change in kinetic energy. For this example, the change in kinetic energy is zero since the mass begins and ends with zero velocity.

Bottom line, the work you did winds up stored in the spring mass system as potential energy. The work you did in compressing the spring is not gone. It just becomes potential energy.

The gravity analogy is when you lift an object starting at rest on the ground and bring it to a point at rest a height $h$ from the ground you do positive work transferring energy to the object. At the same time the force of gravity, which acts opposite the direction of movement of the object does an equal amount of negative work, taking the energy you gave the object and storing it as gravitational potential energy of the object/earth system.

Hope this helps.


Well consider the definition of potential energy here:-

The change in potential energy of a system is defined as the negative of work done by the internal conservative forces of the system.

In your particular case it is the spring force which is internal and is responsible for change in potential energy of the spring.

The work done by external agent is equal to change in potential energy of the system if and only if the change in kinetic energy of the system is zero.

Again, I want to emphasize that when spring is pushed or extended slowly only then the work done by external agent is equal to change in potential energy of the spring system.