The donkey's first use in political parlance to represent the Democratic Party came in 1828, during the presidential campaign of Andrew Jackson. Jackson was a popular war hero (after victories in the War of 1812 and the First Seminole War) and ran a campaign under the slogan "Let the People Rule."
Jackson's opponents attacked him as a populist and branded him a "jackass." But Jackson liked the comparison and used the jackass/donkey as a campaign symbol. Opponents later used the jackass/donkey to represent Jackson's stubbornness in office.
But the person who is most responsible for making the donkey a symbol of the Democrats and the elephant a symbol of the Republicans was a cartoonist for "Harper's Weekly" magazine, Thomas Nast.
He first used the donkey in 1870 to represent an antiwar faction he disagreed with, and the next year he used the image of an elephant in a cartoon warning Republicans that their infighting would hurt them in upcoming elections.
But it was his November 7, 1874 cartoon titled "Third Term Panic" that would forever link the animals as symbols of each party.
At the time, Republican Ulysses S. Grant had served two terms as president and was considering running for a third. In the cartoon, a donkey wearing a lion's skin labeled "Caeserism" frightens off other animals, including an elephant identified as "The Republican Vote."
The caption reads: "'An Ass, having put on the Lion's skin, roamed about in the Forest, and amused himself by frightening all the foolish Animals he met with in his wanderings.' -- Shakespeare or Bacon."
Nast was referring to a series of editorials in the "New York Herald" attacking President Grant for seeking a third term and for what it called his "Caeserism," or undemocratic attempt to seize imperial power. The cartoon's imagery is from Aesop's fable "The Ass in the Lion's Skin," with the moral being that a fool may disguise his appearance but his words will give him away.
Nast continued to use the elephant to symbolize the "Republican vote" until eventually it simply became "Republicans." Soon other political cartoonists followed suit and the donkey and elephant became widely used as the symbols of the two parties.