This metaphor, which means to ruin carefully laid plans, dates from the late 18th century. It owes its sense from the poor conditions of the roads in early America.
Vendors of fruits, baked goods, and smoked eels were common in the streets of English cities. But most displayed their wares in sidewalk booths and stands.
Americans selling apples on the streets in the New World used carts so they could move as customer traffic changed.
This new way of merchandising created a new risk, however.
When a vendor struck a rut or a cobblestone, he might tip over the cartful of apples, causing the loose fruit to roll over the landscape and become bruised in the process.
Today, when you've upset the apple cart - in a figurative sense - you've probably overturned a routine or plan.
SOURCES: 'Facts on File: A Dictionary of Clichés,' by Christine Ammer; 'The Encyclopedia of Word and Phrase Origins,' by Robert Hendrickson; 'Clichés,' by Betty Kirkpatrick; 'Loose Cannons and Red Herrings,' by Robert Claiborne; 'Why You Say It,' by Webb Garrison.