How do you lift a body up from the ground?
The body remains at equilibrium under the acting of opposite forces on it: the $\uparrow$ normal force from the ground & the $\downarrow$ gravitational force . In order to move it up, you have to give some infinitesimal $\uparrow$ force greater than gravitational force which would accelerate the body upwards.
Let the force be $\mathbf F_\text{ext}.$ Therefore the equation of motion provides:
$$\mathbf F_\text{ext}- m\mathbf g = m\;\delta \mathbf a\implies \mathbf F_\text{ext}= m\mathbf g + m\; \delta \mathbf a \;.$$
Let the body gets displaced above by $\bf h\;.$ Therefore the work done by $\mathbf F_\text{ext}$ is given by \begin{align}W_{\mathbf F_\text{ext}}&= \mathbf F_\text{ext}\cdot \mathbf h\\ &= m\mathbf {g}\;\cdot \mathbf h + m\; \delta \mathbf a \;\cdot\mathbf h \;.\end{align}
This work can be assessed as $$\overbrace{m\mathbf {g}\; \cdot\mathbf h}^{\text{work done against gravity}} + \overbrace{m\; \delta \mathbf a \;\cdot\mathbf h}^{\text{amount of kinetic energy increased}}\;.$$
The former work is what you call potential energy- the work done against the gravitational force. Hadn't the force worked against the gravitational force, then the body would have been constantly decelerated by the gravitational force turning all the kinetic energy into potential energy of the system.
At the present context, the later work is zero; so the body is moving at constant velocity.
But how?
There must be a force $\mathbf F_\text{ext}$ to counteract the gravitational force; otherwise the body couldn't move at constant velocity as its kinetic energy would have been converted to potential energy of the system. To counteract the work done on the body by the gravitational force, same amount of work is done by the external force on the body so as to retain its constant velocity; that work turns up as gravitational potential energy.
So, although the net work $W_{\mathbf{g}} + W_{\mathbf F_\text{ext}}= -m\mathbf g\;\cdot \mathbf h+m\mathbf g\;\cdot \mathbf h= 0 \;,$ in order for the body to move at constant velocity, the external force must have to do the same amount of work as done by the gravitational force- this is the potential energy of the system.