What isn't addressed is why they became such horrible shots and only about a 10th as efficient as the Clones in the PT.
There are EU answers to this though... And some film evidence that discounts Stormies being "bad" at their job as well.
First, the Dark Forces game was the first EU attempt at explaining the E-11's ineffective accuracy. It fits with what the E-11's actually earth-based counterpart is. It's a small, sub-machine gun. For WW2 buffs it's the equivalent of a Thompson compared to a Garand... The Garand was a much more efficient weapon at long ranges and in squads, but the Thompson was a one-man wrecking crew in short-ranges, and a good single-man support weapon for a squad.
Dark Forces shows the E-11 as being not WILDLY inaccurate, but it's not a gun you aim unless you "modify" it with a tactical scope (arguably this is a secondary setting for the gun, kinda like the stun setting they have, that requires modular parts to enhance the gun... It's still not perfect long-range weaponry though).
The Clones have a similar support weapon too... The one that climbs the crabdroid and empties a clip is seemingly similar to the E-11.
So DarkForces (and subsequent games in that series) have sort of established the E-11 as just an inaccurate gun... If we take those into account, it works. They're rapid fire, "spray and pray" type weapons, and if all your guys are carrying that it's a crazy scenario. Plus the E-11 seems to be a sidearm of some sort in the Empire as well... Some Sandtroopers carry them while also carrying a larger, longer-barreled weapon that is presumeably more accurate.
It's possible the gun such as Chewie's Stormie rifle he runs around on the Death Star with, or other "Sandtrooper" weapons are then the weapons issued an Imperial "in the field" while the E-11 becomes somewhat a secondary weapon in some cases.
The gun Chewie has, interestingly enough, had a rack of them in the Hangar Control Room... Could be that the more accurate gun is there to fire from the control room should a situation like that arise. A wide open space like that hangar, and that'd make perfect sense really to have a little stash of those from a high vantage point like that.
Anyway, second point about Stormtrooper accuracy... They're only seemingly inaccurate with main characters in Star Wars. That I can buy into as "it's just a movie". I mean, it has to be that way really, so reality sort of goes out the window. "Heroes Luck" is what I chalk it up to then.
But when the EMpire's attacking Hoth, clearing out the Tantive IV, or frying Ewoks... They're fairly efficient with the E-11. The Tantive IV troops are mowed down like crabgrass. Hoth troopers fall back from not only armor assault but also a noted mechanized infantry push who seemed armed with support guns and E-11's exclusively (from what we could see... Unseen in any SW situation is always a major variable to consider... The troops we do see are clearing a "tight" space out though so the E-11 does make sense there again).
Lots of possibilities for either argument as to Clones, recruits, or a mix of the two... I've always felt Stormtroopers got shafted on their efficiency though. When compared to their Rebel enemies (who are quite capable soldiers themselves depending on if you buy into EU or not), the Stormies are deadly efficient.