I have put the summary at the beginning.
Suppose a mass $m$ starting from rest at a height $h$ from the Earth's surface and the kinetic energy of the mass $m$ is to be found when the mass reaches the surface.
The gravitational field strength is $g$ and making the following assumptions:
- the height $h$ is much less than the radius of the Earth so the gravitational field strength can be assumed to be constant
- the mass $m$ is much less than the mass of the Earth so the kinetic energy of the Earth can be assumed to be negligible.
For the Earth-mass system
$$KE_\text{surface} + PE_\text{surface} = KE_\text{height h} + PE_\text{height h}$$
$$\Rightarrow KE_\text{surface} =PE_\text{height h} - PE_\text{surface} = mgh $$
For the mass $m$ system
The work done by the external force (gravitational attraction of the Earth) is equal to the change in kinetic energy of the mass.
This is the work-energy theorem.
$$mg \times h = KE_\text{surface}$$
If you want to discuss potential energy then you must include at least two bodies.
In this case it will be mass $m$ and the Earth and these are now assumed to be the system.
If the mass $m$ is at the surface of the Earth of radius $R$ and mass $M$ and an external force increases the separation between the mass and the Earth by a distance $h$ with $h\ll R$ then the external force has done work equal to $\displaystyle \int^{R+h}_R \left ( \dfrac{GMm}{R^2}\right) dR \approx mgh$ in lifting the mass $m$ a distance $h$.
This assumes that $h \ll R$ and hence $g \approx \dfrac{GM}{R^2}$; the gravitational field strength is constant near the surface of the Earth.
Note that we should expect the work done by the external force to be a positive quantity as the external force direction and its displacement are in the same direction – upwards.
That work done by the external force increases the gravitational potential energy of mass $m$ (and the Earth) by $mgh$.
Normally one does not go through all this mathematics and just assumes that the gravitational field strength is constant near the surface of the Earth.
Consider a mass $m$ as the system.
On the Earth the mass $m$ has a force $mg$ downwards on it due to the gravitational attraction of the Earth.
Suppose that an external force of $mg$ upwards is exerted on the mass $m$.
The net force on the mass $m$ is now zero and if the mass moves up a distance $h$ the work done on the mass is zero and so the change in kinetic energy of the mass is zero.
This is the work-energy theorem in action.
You can consider the two forces individually.
The external force does positive work $mgh$ as the external force and its displacement are in the same direction and the gravitational attraction does negative work $-mgh$ as the gravitational force and its displacement are in opposite directions.
With the mass $m$ now at a height $h$ if the mass is released and allowed to drop to the surface of the Earth then the work done by the external force (gravitational attractive) is $+mgh$ (force and displacement both in the same direction) and this will result in the mass gaining kinetic energy by the work-energy theorem.
In terms of the mass-Earth system this last change can be described by stating that the mass-Earth system loses gravitational potential energy and the mass (and the Earth) gains kinetic energy but overall there is no change in the total energy of the system.
Here internal forces are doing work.
In this last statement there is a hint that usually the assumption $M \gg m$ is made and the kinetic energy gained by the Earth is not included as it is so small compared with the kinetic energy gained by the falling mass $m$.