Suppose there is an object of weight 'mg'. If we apply a force equal to mg, why the object is lifted up as its weight and the force applied are equal and opposite in direction should be cancelled out and the object should not move at all?
If the body starts from rest and the upward force is equal to the downward force then indeed the body will not move.
If however the body had an initial velocity then with no net force on the body it would continue moving at that constant velocity.
Your question is one which comes up when evaluating the gravitational potential energy gained by a body of mass $m$ when it moves up a distance $h$ in a gravitational field of strength $g$ with the results that the gain in gravitational potential energy is equal to $mgh$.
The reasoning being that to move the mass an external force $mg$ moves a distance $h$ in the direction of the force and so the work done by the external force is $mg \times h$ and this is the change in the gravitational potential energy of the body.
What is often omitted is one of the following statements.
- When the external force is applied the mass is already moving upwards at whatever velocity you like (including infinitesimally small!), and as its kinetic energy does not change the work done by the external force is equal to the gain in gravitational potential energy of the mass.
- Right at the start the external force is slightly larger than $mg$ and this accelerates the mass from zero velocity, the external force is then kept at $mg$ until the mass is about to reach a height $h$ and then the external force is made smaller than $mg$ by an amount to ensure that the mass reaches a height $h$ with zero velocity. So the extra bit of work done on the mass by the external force at the start is equal to the reduction in work done by the external force at the end as the kinetic energy of the mass at the start and finish is zero.
When you lift up an object, you are putting in more force than its 'mg'. If you lift using as much force as its force due to gravity, the object would not move at all.