The gas is compressed slowly at constant temperature.
Heat flows to the surroundings. The temperature of the gas (internal energy) remains the same.