Note! this is not quite right on two fronts (more later).
This conversion of kinetic energy into radiant energy cools the gas.
As you crowd atoms together (as in a solid), the allowed energy levels in one atom start to become distorted due to the influence of the electric field of neighboring atoms. Distort an energy level difference a little bit and you get a slightly different frequency emission/absorption line. A distribution of distortions leads to a distribution of lines than eventually blend into a continuum.
Note: There is much more to it than this. The various vibrational modes of the molecules and compounds formed in the solid begin to become important for example.