This would be my interpretation... although let me preface this with this topic is rarely tested in depth so don't fret too much:
The internal energy of the system (the gas and it's container) can be considered its temperature because they are proportional and interchangeable terms on the mcat. The internal energy (temperature) of a system can only be changed by doing work or adding heat to the system, similar to how you can only gain energy by eating or drinking (two different forms of energy intake).
When you compress a gas (do work on the system) the change in internal energy is positive (delta U = q + w ). Thus the internal energy, U, increases and temperature increases upon compression. Note I said nothing about HEAT (q) , because heat and temperature are not the same. Heat is a transfer of energy just like compression, it is not a measure of energy. More technically speaking, U is a state function, q and w are not. If that last bit didn't make sense totally forget it because its not necessary.
What you are thinking is correct but you are missing one small link. When you compress a gas, you do work on the gas and increase its internal energy/temp. The opposite is true of expansion. BUT what THEY are saying is how that system interacts with the surroundings... which it is not perfectly insulated from
If the system you just increased the temp of is in an environment which is at room temp, the way the system and room come to equilibrium is by the system transferring heat to the surrounding or undoing the work that was done.
If I have a piston and compress a volume of air, the gas gets hot. If I don't hold that piston down what happens? It will pop back up to reach equilibrium again. Now what happens if I lock the piston down? Well, if the system is completely insulated, it will do what you expect and stay at a high internal energy (its hot). Note, nothing having to do with heat is relevant so far. Do not mix up heat and temp. Now, if the system you just compressed and locked in place is not insulted completely and cannot reach equilibrium through reversing the work... it releases heat to the environment. That is the heat they are speaking to, the transfer of energy from the system to the environment.