Midrash
The study of Midrashim often enhance our understanding of the narrative in the Torah. The story of Bilaam and his hatred of the Jews, is no exception.
According to the Midrash, there was a striking similarity in the relationship of Moshe and Bilaam, to Mordechai and Haman. Both had previous encounters before the main event was discussed in the Torah and Megillah.
Mordechai and Haman were both sent on a mission by Achashveirosh, to fight a battle on his behalf. Haman had used up his supplies too soon, and begged Mordechai to give him food. Mordechai agreed on condition that Haman accepted being a slave to Mordechai. This agreement was written on the shoe of Mordechai, which he tended to reminded Haman, each time he refused to bow to him, several years later.
In Moshe’s case, he met up with Bilaam when he escaped from Pharoah after killing the Egyptian. Bilaam was living with his two sons in a town that Moshe conquered on behalf of כוש in a war that led to his becoming king of כוש for forty years. The Midrash says that Bilaam felt humiliated by Moshe in that battle.
This was the background to the request of Balak to ask Bilaam to curse the Jews and weaken Moshe. This also explains why he was so eager to accept this offer.
The Midrash is fascinating but we need to be careful in its study. A Chassidic master once said, “Anyone who believes Midrashim, is a fool. Anyone who doesn’t, is a heretic!