As your car drains fuel from the fuel system, fresh air must come into the gas tank to take its place. A small amount of suction is necessary to ensure an uninterrupted flow of fuel. Excess suction leads to a vacuum in the tank that makes it difficult to remove the gas cap for refilling. There are a handful of different features in all fuel systems designed to vent fresh air back into the tank, preventing a strong vacuum.
Most caps for the gas tank feature a vent built into it that allows vapors to escape from the tank, while drawing fresh air in. When this vent becomes blocked or damaged, a vacuum may build up. The cap will be hard to pull off when fully unscrewed. You will also hear a loud pop or sucking noise when you do remove the cap. Cleaning buildup out of the cap vent or replacing the cap with a new unit stops the problem.
Some gas caps are fully sealed. In vehicles using these caps, a pressure relief valve is located elsewhere, usually on the vapor line, according to "Automotive Service: Inspection, Maintenance, Repair" by Tim Gilles. These valves should remain closed most of the time to maintain a slight vacuum in the fuel system and prevent excessive emissions. When they get stuck in the closed position or blocked with soot, a high vacuum builds up that seals the gas cap and makes it hard to remove.
To manage the amount of vacuum pressure the evaporation values produce, some cars use a solenoid to monitor the amount of pressure per square inch (PSI) in the fuel system. When vacuum levels drop, the solenoid closes the valves to increase pressure. If the solenoid becomes damaged and stays stuck in the "on" position, the fuel system will build up enough suction to create a strong vacuum at the gas cap.