Before getting into the microscopic basis of temperature, a short digression on units which maybe won't be so short
The product of pressure times
temperature volume has units of energy. Pressure is force per unit area and work, which has units of energy is defined as force times distance. It is easy to show that if, for example, pressure is held constant then the amount of work that is done in an expansion is Pext (Vfinal - Vintiial)where the volume changes from Vinitial to Vfinal
The ideal gas law states that PV = n R T where n is the number of moles R is the gas constant and T the temperature. We have already discussed how at zero pressure (or volume) the temperature of the ideal gas would be zero, and how, since negative pressure and volume are not, (That's not possible), the zero is absolute. We have also mentioned how the International Temperature Scale is defined by absolute zero and the triple point of water and a bit about how a triple point uniquely defines a single temperature and pressure. This, by the way is an answer to the problem of how to define units for those on other planets.
n is a measure of the number of molecules in the gas. It is the number of molecules divided by Avogado's number. What is Avogadro's number, NA, somebunny in the last row asks. Well it's a number, 6.02 x 1023 but more importantly it's the chemist's bridge between the lab and the molecular scale. Chemical reactions occur between individual molecules. It's pretty hard to count molecules, especially if they are moving about in a gas or a liquid.
If we know the atomic mass of a molecule, then Avogadro's number of them 6.02 x 1023, weighs the numerical value in grams. Why grams, because when the idea first came up, everybunny was using the cgs (centimeter/gram/second) system of units, not mks (meter/kilogram/second) and not SI which is based in mks. Also, because lab balances tend not to weigh more than a few hundred grams.
Slipped one by you there. How do we get atomic mass. Well, we define the mass of carbon-12, (a carbon atom with 6 protons and 6 neutrons and 6 electrons) as 12 atomic mass units, known today as Dalton (Da). This is a definition. It is then possible to find the relative masses of all the other atoms relative to 12 C. There is something of a history of how carbon-12 was chosen as the basis of the atomic mass scale. Wasn't always so and it was a bit of cats and dogs or chemists and physicists.
Avogadro's number of 12 C atoms then weighs precisely 12.000000 grams. The uncertainty is the uncertainty in Avogadro's number, which is the fundamental constant of most uncertainty. The hunt for the next decimal places is exciting, even if scientists are easily excited if for no other reason that it will turn the kilogram into something other than a lump of platinum iridium sitting in vault in Paris enabling better communication to other planets.
Which brings us back to the ideal gas law and in particular RT. Since PV/n has units of energy, then the units of RT must be energy per mole. If the units of energy are Joules and the units of temperature are Kelvin, then the gas constant has units of J/K. (added: the inportance of this is to establish a connection between temperature and energy. The exact relationship awaits)
What remains is to establish the connection on the molecular level. That's dangerous, because it requires statistical mechanics a well known deadly science