The idea of a "US education system" is relatively new. For example, the Northeastern US has long been one of the most educated areas of the country. The Puritans valued education because they wanted their children to grow up to be able to read the Bible, and education was always useful in a society which was built heavily on commerce. Some of the country's oldest and most prestigious universities (the Ivy Leagues) were founded in the northeast. The same cannot be said for places like the rural South, where the elite was able to hire tutors and send their kids to Europe. Obviously, most African Americans had almost no access to education until the civil rights movement, but poor whites (the majority of Southern whites) fared scarcely better. This educational disparity was lessened after World War II, when public education became more integrated. (Some argue that the disparity still continues even today).
The US's first public education, unsurprisingly, was established in Massachusetts by Horace Mann. It was modeled after the Prussian educational system, which was developed by Wilhelm von Humboldt, the equally brilliant brother of Alexander von Humboldt, a linguist, philosopher, and government official whose ideas laid the groundwork for modern-day educational systems around the world. It was not only intended to "equalize" by bringing children of all classes together, it also intended to build character through discipline and work, much like schools today. It was also the first secular school system. However, secular schools were at first shunned in favor of parochial schools, until those became associated with immigrants. With the passage of the Blaine Amendments, the states started restricting taxpayer funding to parochial schools, which strengthened public education even further.
The public university system mostly has its origins in the land grants of the late 1800's, which were specifically designated for educational purposes. An example of this is University of California, Berkeley, which was established in 1868.
Community colleges emerged independently a little later, as a way of offering education to a wider audience and minimizing the costs for the first two years of education. Usually, these were extensions of high school, and offered mostly for teachers. Community colleges became more popular for vocational schools during the Depression years, and received a huge boost after World War II with the G.I. Bill.
I can only provide the economic and social standpoint for this, but basically children were working in factories when the Industrial Revolution really took off. Mid 19th century. Children were harmed, moral obligations were looked at, and child labor laws were put in place disallowing a certain age to go to work. So, with busy parents all over the US, compulsory education really took off. People sent their children to school, and they would stop worrying about their kids getting harmed. Back before child labor laws, children were crawling under industrial machines to clean, climbing equipment to reach things, and generally making mistakes- ones that impact their life more than working adults with a well postured composure. Children even used to work in mines! Not only were children undisciplined in work they had to do every day, they were clumsy and loud. Some children were actually drugged to quiet down in the workplace. So it's not hard to believe that moral objections were raised over the decades following the first industry - regulating laws that were passed.
Edit: I thought it's fair to mention that even women worked in factories, sweat shops, etc. The many large households that comprised the working class could not have sustained raising children and arduous physical labor, therefore a solution was reached in the form of free, compulsory education.
The other answers here are great, but something to keep in mind. Education is one of those things that the Tenth Amendment to the US Constitution says (indirectly) falls to the states to manage. So there isn't really a "US education system." Education systems vary state-by-state. The No Child Left Behind legislation is a recent phenomenon of the federal government getting more involved in state programs.