There are many reasons, none of them was quality.
1 - Mismanagement from Atari, Commodore and others
2 - Microsoft deals with OEMs
3 - Pretty cheap Taiwan and Chinese parts, some of them with doubtful quality
4 - Windows piracy, alongside the cheap parts, allowed many small PC shops to thrive and offer nicer deals
5 - PCs were the majority of computers at work and school, so the only one parents saw as a good buy for their children future.