According to Jewish tradition, Haman, the evil character in the Purim story, wore a three-cornered hat. Somewhere along the way in Jewish history, the idea of Haman and his three-cornered hat was cleverly combined with a popular pastry called "Mantashen" to form "Hamantashen." In Yiddish, "Mantashen" means poppy seed pockets and "Hamantashen" means "Haman's pockets."
While originally hamantashen pastries were filled with a poppy seed filling, over time the fillings became more varied. Today there are hamantashen filled with fruit preserves, chocolate and even peanut butter.
In Hebrew, the pastry is called "Oznai Haman" which means Haman's ears. This name may have come from the Midrash which says that when Haman entered the King's treasury, he was bent over with shame and humiliation (literally with clipped ears).