The internal energy of a body is the sum of all the energies of all the atoms or molecules of the body due to their random motion and position.
It is not due to the motion of a body as a whole – the internal energy of a car does not depend on how fast the car is moving. Internal energy is a property of the molecules that make up a body, not of the body itself. All substance possess internal energy, because the molecules of all substances all have kinetic energy and potential energy.
For an ideal gas the internal energy is proportional to the absolute temperature:whereis the molar gas constant andis the number of mols in the gas. The molecules of an ideal gas do not exert forces on each other, so the internal energy is due solely to the kinetic energies of the gas molecules. In fact no gas is truly ideal. The molecules of an real gas exert forces on each other, so at any instant the molecules of a gas will also have potential energy, and the internal energy is the sum of the kinetic and potential energies.
For a liquid the intermolecular forces are stronger as the molecules are closer together, so the potential energy contribution becomes more important.
For a solid, we may think of atoms and molecules vibrating about their mean position. The potential energy is due to the strong binding forces between molecules and atoms, and the kinetic energy is due to the vibrations of the atoms and molecules.
Internal energy is useful in that it allows us to distinguish between temperature and heat. For an ideal gas, temperature is a measure of the average kinetic energy of the molecules. It does not depend on how many molecules are in the gas. Internal energy is the sum of all the kinetic energies, and is proportional to the number of molecules. We expect heat to flow from a hotter to a colder body, but not from a body with more internal energy to one with less if that body with more internal energy is at a lower temperature.