The tradition to eat hamantashen on Purim began in Europe. The word hamantashen derived from two German words: mohn (poppy seed) and taschen (pockets). Mohntaschen is German for "poppy seed pockets" and was a popular German pastry. Hamantaschen means "Haman's pockets" and became a popular Purim pastry. It was rumored that the evil Haman's pockets were filled with bribe money.
The most popular explantion of why Jews eat this three cornered pastry on Purim is that Haman wore a three-cornered hat. Eating an image of Haman's hat is a way to symbolically destroy his memory.
Another explanation for the Purim hamantashen eating tradition comes from the Midrash (Jewish commentaries on the Hebrew Scriptures). The Midrash describes Haman bent over, covered with shame, and humiliated (literally with clipped ears) when he entered the King's treasury. The three-cornered hamantashen are symbolic of Haman's clipped ears. In Hebrew, hamantashen are called Oznay Haman, which means Haman's ears.
A fourth explanation for the popularity of the three-cornered pastry on Purim is cited in Alfred J. Kolatch's The Jewish Book of Why. Kolatch writes that Esther derived her strength from her antecedents, and the three corners of the hamantashen cookie represent the three patriarchs (Abraham, Isaac and Jacob).