My guess is that the molecules of gas all have the same speed as before, but now there are much more collisions per unit area onto the thermometer, thus making the thermometer read a higher temperature. If this is so, then density is directly related to temperature when a substance experiences a change in density.
Is this the case?
Best Answer
Because you are doing work to compress the gas, and the energy has to go somewhere. The molecules speed up because they collide with the wall moving forward--- if you move a wall forward, a ball which bounces off the wall reflects going faster by twice the speed of the wall, because if you move along with the wall, it reflects at the same speed.
Answers to comment questions
Entropy increase
There is a second way to understand the temperature increase. When you squeeze the gas, you are increasing your knowledge of where the molecules are, you are decreasing their wandering volume. This means that, if nothing else happens, you decrease their entropy. So something must have happened to make you know less about the state of the universe. If they are not allowed to dump heat and entropy into the exterior universe, the only thing that can happen is that they move faster, increasing your uncertainty about how fast they are going.
The decrease in entropy with a decrease in volume from $V_i$ to $V_f$ is
$$ N\log({V_f\over V_i}) $$
This is intuitive--- the logarithm of the number of configuration is the log of $V^N$ (ignoring an N! denominator from indistinguishable particles.
The increase in entropy from a change in temperature from $T_i$ to $T_f$ is given by
$$ NC_V \log({T_f\over T_i}) $$
Where $C_v$ is the rate of entropy increase per unit temperature. So that the relation that the entropy is constant gives the adiabatic expansion law: $V\over T^{C_v}$ is constant, that is, the ratio of absolute temperatures before and after is a certain power of the ratio of the volumes after and before.
I should point out that if you move the piston extremely quickly, at comparable to the speed of sound of the gas, you will produce extra heat in addition to the minimum necessary to ensure the entropy doesn't go down. The extra heat can be understood in two equivalent ways:
This is a classical more-you-know less-you-know statement, that the more precisely you know where the molecules in a gas are, the less precisely you know how fast they are moving (the hotter the gas gets), at constant information (entropy). This is not the Heisenberg uncertainty principle, it is just classical thermodyanamics, and here the knowledge interpretation is exact, because the entropy is a measure of classical knowledge you have about the microstate. The quantum mechanical uncertainty principle is not a statement of ignorance about hidden variables, at least not in any obvious way, so it doesn't have a precise informational interpretation like this does.