I did lot of searching but couldn't find any textbook nor any webpage which could clarify my doubt. Maybe my doubt is insanely stupid and I was dumb for not realizing it at the first place.
The negative of the work done by the electrostatic field in bringing a charge from infinity to a point is called electric potential.
Let us assume that there is a positive charge at the origin. Let work done by the external force to bring a positive from infinity to a point P close to the origin be W. And hence work done by the field to bring a positive charge from infinity to the point P will be -W.
If I did work W to bring the charge from infinity or if the field brought the charge from infinity, either way the change in potential energy will be same.
In case of work done by the field, we say that the work done is stored in the form of electrostatic potential energy.
In case of work done by the external force, we say that the work done was positive and the energy was taken by some external source.
In the above case, I did work W in bringing it & the field did work -W on the charge trying to push it away so I did positive work of W & the field did negative work of W. We can say that the work done by the field was stored as potential energy.
Where did the work done by the external force (me) go?
I can summarize the whole doubt in the following line: I did work W to bring an charge towards another unlike charge, and therefore the field also did work -W, the net work done on the charge is 0. But there is still a change in potential energy. Why did the potential energy change? Isn't conservation of energy being violated here?
Please clarify my doubt (I do understand that there is a horrible conceptual error in one of my arguments but I do not know which one it is). If I am not wrong this has nothing to do with electrostatics rather has to deal with field theory/inverse square law. I believe I will be encountering the same problem again when I would be studying another force, maybe gravitational, which obeys inverse square law.
Thank You