Both statements are correct: Gases tend to liquefy under pressure and gases liquefy in colder temperatures. However, in both cases it is implicitly assumed that the other quantity remains unchanged. This is, if you increase pressure slowly enough to give your gas time to transport the increase in heat to the surroundings, then it will eventually liquefy.
To illustrate, look at the working principle of a chiller. In a first step, a working gas is compressed; it increases in pressure and in temperature. The compressed gas is then lead through a heat exchanger on the outside of the machine, where it cools down to ambient temperature. The heat is transported to the surroundings (this is why your fridge is hot in the back). Then the dense gas is allowed to expand again on the inside of the machine and its temperature decreases below the original temperature. The temperature decrease during expansion is just the inverse the temperature increase during compression. With this mechanism way you can cool down gases and eventually liquefy them. The important thing is to dissipate the heat to another medium.