That's the inherent problem with classes, you have to teach 30+ students the same but they're not all capable of learning at the same pace or in the same way.
Kids who can't keep up fall behind, while those that are faster get bored and start to misbehave so they get labelled as troublemakers.
You also have the peer pressure from other kids, who will mock or even bully the top and bottom percentages of the class respectively, discouraging them from participating.
Catering to each child and teaching them at their own pace is obviously going to work best, but it doesn't scale to a school system.
If one or both parents is free to teach the kids that's great, but there are many cases where they aren't - some parents don't give a shit and are happy to send their kids off to school, many parents have to work and simply don't have time to teach the kids even if they would be willing/able to do so, and some simply don't have the ability to teach.