If I lift a box vertically, why is the work I do equal to the distance I lift it times the force of gravity on the box? I have problems fully understanding the concept of work, so please forgive me if this is simple. If I take a box of mass $ m $, and lift it a distance $ d $ vertically, why is the work I have done equal to $ gmd $, where $ g $ is the force gravity exerts on the box? I understand that work is equal to force times distance--so I'm not asking about the definition of work--but if I exert an upward force equal in magnitude to gravity's, won't the box remain motionless, i.e., net zero force, in which case the velocity is constant, and displacement and work done will be equal to zero?
Edit: To be clear, what I'm asking is not a duplicate of "Why does holding something up cost energy while no work is being done?", because I'm not asking about work done on an object with zero displacement, nor is it a duplicate of "What exactly is F in W=∫baFdx?", because I'm not asking about the distinction between the work done by an individual force and net force.
 A: You ask

if I exert an upward force equal in magnitude to gravity's, won't the box remain motionless, i.e., net zero force, in which case the displacement and work done will be equal to zero?

The box will not necessarily remain motionless, but it is true that the net work will be zero.  If the force you exert is equal and opposite to that of gravity, then Newton's Second Law tells us that the acceleration of the box is zero.  This still allows for the box to be moving at a constant velocity from the initial height to the final height.
To address the following question more generally (even for the case when the force you exert is not necessarily equal to that of gravity)

why is the work I have done equal to $gmd$

tt helps to know the so-called Work-Energy Theorem.  The theorem says that the work done by the net force on an object equals the change in its kinetic energy;
\begin{align}
  W_\mathrm{net} = \Delta K
\end{align}
Now suppose that the box is at rest at some point $a$ and that you move it to some other point $b$ at rest.  Then the change in kinetic energy will be zero $\Delta K=0$.  On the other hand, the work done by the net force is the sum of the work done by you, and the work done by gravity; $W_\mathrm{net} = W_\mathrm{you} + W_\mathrm{gravity}$.  Combining these facts with the Work-Energy theorem gives
\begin{align}
  W_\mathrm{you} = -W_\mathrm{gravity}
\end{align}
as desired.
A: Yes, the net work on the box will be zero. The same holds if the box were sitting on a table.  The table counters the force of gravity on the box. However, your muscles are not static. The muscles do not lock into position; they require a continual feed of chemicals to keep the static force on the box. That is why you are still doing work when holding the box: not on the box, but in keeping your muscles contracted.
