Volume of a gas is directly proportional to its temperature, at constant pressure, according to the Charles' Law. However, during compression, the pressure does not stay constant, it actually increases and hence the proportionality between volume and temperature is no longer valid. Similarly, the pressure is directly proportional to temperature, at a constant volume. However during compression, volume decreases and hence this relationship is also not valid. We need a relationship between pressure, temperature and volume. These parameters are connected by the following relationship:
PV/T = constant
During compression, pressure will increase and volume will decrease, an interplay of these two parameters (the value of their product) will determine whether the temperature rises or not. In general, a pressure increase will cause a temperature increase since energy is imparted to the fluid during compression.
Hope this helps.