The Motivation for the War of Gog and Magog(Masechet Berachot Daf יג. Perek 1 Siman 173)
(based on Ein Ayah, Berachot 1:173)
Gemara: It says (Yeshaya 43:18-19): “Do not mention the first things”- this is enslavement of the exiles; “and the previous matters do not contemplate”- this is the exodus from Egypt. “I am doing something new, it is now growing”- this is the wars of Gog and Magog. Rav Yosef cited: this is a parable of one who went along the way and came across a wolf and was saved from it … a lion … a snake and was saved from it. He forgot about the earlier events and told about the snake.
Ein Ayah: It seems that all of the nations’ opposition to Israel was for selfish purposes, whether it be to become enriched by destroying Israel or because of their stinginess lest we get something that they might have gotten, or so that their strength not be weakened when our spiritual strength grows. However, the war of Gog and Magog will be just for the desire to hurt and destroy, as a pasuk in Yechezkel (39:2) hints. They will not have any interests about which we cause them problems, and we will be living in our land, seeking peace with all of our neighbors. Only the desire to destroy and the jealousy toward Israel will bring it about. In that way, they are compared to the snake, who bites without benefit, unlike the lion and wolf, who kill one in order to eat. This type of attack is very dangerous. However specifically from there will flourish the true salvation of Israel to glorify, and the Divine Name will be sanctified through Israel.