A gas is enclosed inside a cylindrical vessel fitted with a piston. When the piston is moved in, gas heats up. It is because
Let a gas molecule was travelling with speed u before collision. When piston moves towards it with a speed v, relative speed = u+v . By elastic collision theory, speed of molecule after collision = u+2v . Hence, molecule speeds up.
Temperature is directly proportional to velocity statistically .