There are are two ways to make a gas hot. This is summed up quite neatly by the First Law of Thermodynamics:
ΔU = Q + Won
This law says that ΔU, the increase in internal energy of a system, can be brought about by
(1) Q, supplying heat to the system, or/and
(2) Won, doing work on the system.
Microscopically speaking, compressing a gas must involve a surface, let’s say a piston, charging into the gas. During this process, the piston is like a giant tennis racket smashing back all the trillions of tennis balls, i.e. the gas molecules, that happen to collide into it.
These gas molecules were sent flying back at higher speed than before. Since the average KE of the gas molecules increases, and the temperature of the gas increases.