The code indicates a leak in the evaporative emission control system (or a defective or loose gas cap but you've already checked that). The system collects gasoline vapors from the gas tank in a charcoal canister and, as you drive, the vapors are diverted to the combustion chamber and burned.
Before this, the vapors were just vented to atmosphere as you filled the tank. It's an environmental control.
If this system isn't allowing the vapors to be withdrawn from the gas tank, then as you add fuel there will be no place for the vapors to go. A small amount may escape from the filler neck, but it's probably not enough to help your situation. With the trapped vapors (instead of gasoline) consuming the volume of the tank, the gasoline dispenser sees this as a full tank and disables flow.
A mechanic could probably diagnose which components are defective, but that's the jist of how it works.