I don't think most people are intentionally assholes at the register, I just think that we're genetically programmed to switch to Moron Mode the moment we stand at the register.
There's nothing fun about standing in line to be served - you're in a group of sweaty, tired, annoyed people and you are equally annoyed as them because you all share a common goal - putting all your crap on the register, have it scanned, pay as little as possible and leave immediately. All of you sweaty, tired, annoyed people in Moron Mode will do anything to make the waiting end.
Waiting is not fun. Waiting in a sweaty, angry mob is even less fun. Since you are in Moron Mode at this point because you're bored out of your skull, you immediately forget what you want to purchase, what's your PIN number, where's your money, where you parked your car and why you're even there - your only instinct is to move forward along with the herd or preferably past the herd, and in this scenario, courtesy goes straight out the window.
As a person in line, as the time goes by, you instinctively put the blame of your predicament on the person serving the line - the poor clerk at the register. He's the asshole who's keeping you all hostage, he can go straight to hell. He is also annoyed, because a mob of angry, tired, sweaty people rushes him rudely to do his job as quickly as possible while simultaneously dealing with their shitty vouchers and customer cards and while his manager is looking at the CCTV, making sure that he informs each and every customer about the latest promotions and offers them a shitty club card nobody really wants.
This is an environment designed to upset everyone, it never goes smoothly and it cannot go smoothly. It cannot go smoothly because you're in Moron Mode and you've forgotten why you're even there, so you gradually have to come back to your senses when it's your turn, collect your goods, find your money, your shitty vouchers, your crappy club card (lest the bastard clerk offers you one), where you parked your car and why you're even there. In the meantime, the clerk will be annoyed by you because you're another angry and sweaty butt who comes to the register without knowing what he actually wants, making his life miserable.
Once you are done performing this elaborate dance, both parties are equally upset. You always leave with a foul taste in your mouth because one again the bastard clerk took forever to scan your purchases and didn't even explain why the bread aisle has been moved which completely spoiled your shopping experience and because another idiot customer came to the register without even knowing where the bloody bread aisle was even though it's been there forever now. Why is the bread aisle important? Because the clerk sits in his little booth everyday and sees the aisle 24/7 while you only shop once a week, so what's common knowledge to him is astrophysics to you and there's next to no chance that you will find a common tongue.
The only possible scenario in which these problems do not surface that I have come across is self-checkout. You still wait in line, but you're only ever upset at the crowd that's taking its sweet time at the self-checkout machines (idiots, they don't know what their PIN is or why they're even there. I wonder if they remember where they parked) with you or at yourself (because once again you've forgotten your PIN and god knows where you parked), eliminating any and all bad blood between you and the clerk, who has it infinitely worse than you do.