Well, some guns (CZ's for example) come out of the bag/box so gooped up in preservative that you'd get sprayed with stuff at every round if you didn't clean it first. And the stuff the slather on for shipping and storage is usually not really an ideal working lubricant, and it will be a huge dirt trapper as you fire it. I run my revolvers with very little lube at all, and my auto loaders may get well lubed on the rails, but very light on everything else.
Plus, I like to inspect thoroughly. Yes, a factory new gun should be sound and safe, but I'd rather check myself then take it for granted. And if there was a QC or parts issue, I could immediately take it back to the gun shop and it would be clear that it came that way (so fix it) and was not a result of being shot (always much easier to get a replacement that way, if an issue was significant enough to warrant one).
I always disassemble new mags too, clean them out, wipe the inside walls and springs with a silicon rag, then reassemble them and load them up for the first time.