In an article Mike Cohn tell us his view of the difference and in the comments there is a really funny and clear example by Ian Mitchell let me quote here:
Suppose you walked into a travel agency to arrange a vacation. “As an agile consultant I need a trekking vacation so I can get away from computers for a while”, you declare.
“OK Sir”, says the travel agent. “We can work with that. What do you think would make a really good trekking experience?”
“I have two acceptance criteria”, you assert. “There must be mountains and there must be goats.”
The agent then discusses this requirement with you further, and before long you have planned out a superb vacation in Switzerland. It will require the collaboration of many parties, including airlines, train companies, hotels, tour guides, and others. Your part of the plan is represented by an itinerary, in which you can see that you have several tasks. You must catch a flight to New York and then connect to Zurich. Then you must catch a train to the mountains where you can walk around for a few days and look at the goats, before beginning the return trip home.
Some replanning of these tasks may prove necessary. It could be that you have to divert to Amsterdam before connecting to Zurich. Perhaps you need to get a bus up into the mountains instead of a train, or perhaps the entire trip must be replaced by an equivalent one in Austria. The “user story” you asserted remains valid throughout, even if the planned itinerary of tasks changes, and it establishes the parameters for conversations about replanning and what may or may not be acceptable.
It’s worth bearling in mind that although User Stories and tasks are commonly associated with Scrum, neither are part of the core framework. All Scrum provides for are items on a Product Backlog and a “plan” for achieving a coherent goal. Stories and tasks are common ways of implementing these respective parts of the framework, and that can help establish a useful context for distinguishing between them.