There's a lot of possibilities, but one that springs to mind is that restaurants are quite wasteful compared to home cooks.
Also equipment fails, vendors mess up, etc.
A friend used to work at a known cupcake chain in London and she literally threw out 30+ cupcakes a day. Whenever I was around, I'd try to convince her not to throw them but giving the box to some homeless or random passerby. Although that wasn't a common event given the boss.
So no, many places are stupidly wasteful, sometimes because of silly legislation.