Esther 9:24 (ESV)

24 For Haman the Agagite, the son of Hammedatha, the enemy of all the Jews, had plotted against the Jews to destroy them, and had cast Pur (that is, cast lots), to crush and to destroy them.

The author goes on to explain how the feast came to be called by the name Purim.

Haman is described again as the Agagite, and this time as “the enemy of all the Jews.” Since Haman plotted to destroy all the Jews, it was only fitting that all the Jews had to celebrate their deliverance from his hand.

The name of the feast, then, came from the lot (the pur) that Haman had cast in order to determine the day of the Jews’ destruction.