The temperature of the gas depends upon the kinetic energy of the gas or say on the speed of gas molecules. So the expansion of volume does not affect temperature, and the same goes for compression of volume.
But the pressure of gas is energy density and density decreases with an increase in volume and vice versa, so pressure inversely depends upon volume.
If a gas does not expand the piston by itself then the temperature remains the same, because the energy of the molecules do not lose in collisions. One thing to be noted is that temperature cause speed, not the speed causes temperature and high speed or vibration of molecules is to cool down.
In air conditioners or high speed jets, speed causes condensation or cooling down. Physics has many contradictions like it. It is said that the expansion of the universe cools it down, but thermodynamics says expansion without work doesn't lower energy of the matter.