Think about the work-kinetic energy theorem, which states that the net work done on an object is equal to its change in kinetic energy:
$$W_{net}=\Delta\mathrm{KE}.$$
You are right that when lifting an object of mass $m$ by a height $h,$ in a uniform gravitational field, the work you do is $W_{you}=mgh$ (assuming, as you said, that you're applying a force of $mg$), and for that same displacement, the work done by gravity is $W_{grav}=-mgh.$ The fact that these two cancel out ($W_{net}=W_{you}+W_{grav}=0$) means that the change in kinetic energy of the object after being lifted is $0$. So the work done by gravity went to sucking energy out of the object that you were adding, thereby converting it to gravitational potential energy. (If it did not get sucked out, then the object would gain kinetic energy--just imagine a case where you apply the same force to the object as you did when you lifted it, but this time there is no gravitational field. Then, since there will be a net force on the object in that case (or, net work will be done (by you)), the object's KE will increase.) Meanwhile, the change in gravitational potential energy of the object is $\Delta U = -W_{grav}$.
So, to summarize, you do positive work on the object by lifting it. Normally, that work would cause the KE of the object to increase. In this case, though, we have gravity doing negative work simultaneously, so the work you're doing is getting converted to potential energy by gravity. No net work is done, so the object has no KE after being lifted.