“How does that happen?”
Some people follow the logic that “I hate XXX, and YYY hates XXX, therefore YYY must be good.” Or “XXX hates me, and XXX hates YYY, therefore I should like YYY”.
Neither of those is actually a logical statement, they just have a veneer of logic, which is enough to fool a lot of people.
But history shows your enemies were once your friends.
We beat Japan, China became our enemy.
We beat Germany, The Soviet Union became our enemy (even though we weren’t really friends during the war).
We helped defeat the Soviets in Afganistan, we got Bin Laden.