Forces can be categorized in a number of ways, external versus internal is one of the ways. One way to describe the difference between external and internal forces is the way in which the force is able to change the total mechanical energy (kinetic plus potential) of an object.
The net work done by an external force on an object can change the sum of the objects kinetic and potential energy. Positive work increases that total whereas negative work reduces the total. Examples of external forces are contact (applied) forces, tension, normal forces, and friction forces. These forces are sometimes referred to as non-conservative forces.
If the only type of force doing work on an object is an internal force, the sum of the kinetic and potential energies will be constant. Examples of internal forces are the force of gravity, spring forces, magnetic and electrical forces. These forces are sometimes referred to as conservative forces.
ADDENDUM:
First, I wish to make it clear that the above distinctions between internal vs. external forces are only one possible way to distinguish them. I completely agree with the following statement made by G. Smith:
“The main thing to understand is that you make this distinction as part of your analysis. Nature does not.”
However, if you choose to make the distinction in the way I have, the following are a couple of examples of the application of this distinction.
Gravity-
A rock of mass $m$ sits on the ground. I lift the rock to a height $h$ above the surface. The rock has acquired gravitational potential energy ($mgh$). Since I have increased its mechanical energy, the force I applied would be considered external by virtue of the distinction given. By my doing work I have transferred energy from my body to the rock.
I now let the rock go. It falls due to the force of gravity. When it reaches the ground it loses its gravitational potential energy but gains an equal amount of kinetic energy. Its total mechanical energy is unchanged. By virtue of the distinction given above, the force of gravity is an internal force.
Spring-
An ideal coil spring attached to a vertical wall has a mass attached to its free end sitting on a frictionless surface in mechanical equilibrium. I pull the mass increasing the length of the spring by $x$ from its equilibrium position. I have given the mass a potential energy of $\frac{kx^2}{2}$ by virtue of its new position on the spring relative to its original position. I have transferred energy from my body to the mass. The force I applied is external. I have increased the masses mechanical energy.
I release the mass. The mass loses its potential energy but gains an equal amount of kinetic energy so that $\frac{mv^2}{2}=\frac{kx^2}{2}$ as it passes through its original equilibrium position. There is no net change in the mechanical energy of the mass. The spring force is internal. (Of course the mass will continue to oscillate converting between kinetic and potential energy.)
Hope this further helps.