An object increases its energy when raised through a height. This is because work is done on it against gravity while it is being raised. The energy present in such an object is the gravitational-potential energy. This gravitational-potential energy of an object at a point above the ground is defined as the work done in raising it from the ground to that point against gravity.
An object of mass m, when raised through a height h from the ground, then work done by this object will be
W = force x displacement = mg x h = mgh