Because a gas cap that isn't tight becomes a pressure leak in the EVAP system. The systems diagnoses itself and if it detects a pressure leak it will set a code. Tighten the cap, pressure leak goes away.
2004 Impala LS - got some mods sold!!!
2009 Subaru Impreza WRX STI
NAIOA moderator Still Imp'n, just in a different Imp.