If we model the atoms in a solid as being held together by tiny springs, the random kinetic energy of each atom constantly switches between kinetic energy and elastic potential energy. You can add thermal energy to an object by doing work on the object. If you rub an object, the force of sliding friction does work, and changes ordered kinetic energy into thermal energy. If fuel burns, chemical energy is converted into thermal energy. Atoms in molecules and solids are held together by chemical bonds.
Chemical bonds are electromagnetic in origin, but can be modeled well by tiny springs.
Two atoms held together by a spring have an equilibrium position. If they are pushed closer together, they repel each other. If they are pulled farther apart, they attract each other. If they are displaced in any way from their equilibrium position and then released, they start vibrating about their equilibrium position. A atom can form different chemical bonds with a variety of other atoms.