Good angels want to do God’s will and to help us.
Bad angels want to go against God’s will and hurt us. However, God is such a good planner that He can fit their evil acts into His plan, and make them turn to our benefit. So if we trust God and do His will, all things work together for our good.
The fact that the bad guys don’t have any intention of helping us is still true, and we sure don’t owe them any favors.
The same thing goes with evil humans. If some guy from ISIS cuts off my head, he’s not intending to help me. He’s hoping I go straight to Hell, and given how lousy they are at cutting off heads, he’s probably hoping I suffer a lot along the way.
But if I trust in God and pray for my enemies and do all the things God has commanded, then even my death can work in my favor. As someone martyred for hatred of the faith, I can go straight to Heaven. As a saint, I can help my friends and relations by powerful prayer. Since the ISIS guy would be a human and not an evil angel, I could even pray for him and try to convert him. That’s why there’s a long tradition of those who kill martyrs tending to repent and become Christian.
All things work together for those who love and serve God, including (inadvertently) the evil works of our enemies. That doesn’t make those evil actions into good actions; it doesn’t make evil humans or angels into actual servants of God. But God can use those actions for His own purposes, even despite them.