The Medrash says that Yehoshuah was chosen to lead the fight against Amalek for a very specific reason. When the story is supplemented in Devarim (25:18) we're told that Amalek did not fear G-d. Yosef testified about himself (and his actions backed him up) that he feared G-d (Breishit 42:18). Yehoshuah was a descendant of Yosef and thus it was a pure poetic justice for him to take on that war.
It is clear from the Torah that G-d is meant to be acknowledged and feared by all people. Avraham said that as a result of there not being fear of G-d in a place they would kill a man to take his wife. Kayin and Hevel before that were expected to make appropriate offerings to G-d. The generation of Noach was destroyed and the people who built the tower of Babel were dispersed due to lack of fear of G-d.
Yosef tried to teach Paroh about G-d, and at some point it seems Paroh learned the lesson. This was Yosef's forte'. He resists tempation because he fears G-d. When he is posing to his brothers as an Egyptian ruler he still says repeatedly that he fears G-d. He sets an example for what every human being should be - one who fears G-d.
Amalek may have had the idea that G-d was a Jewish thing. They seemed to think that fearing G-d was not for them. But fear of G-d is for all people. Yosef taught this lesson. And so it made sense for his descendant to be the one to oppose the misguided nation of Amalek.
(Inspired By and Adapted From Thoughts of the Magid of Dubno)