Funny thing is, the minions look like they're fighting for the bad guy in 'Despicable Me 2', but they aren't true allies — they're victims. In the film they're kidnapped and exposed to the PX-41 serum, which turns them into those purple, unthinking, super-strong versions that obey whoever controls the serum or whoever's leading the attack. That’s why it feels like they’ve switched sides: they’re physically changed and acting aggressively, not making a voluntary moral choice.
I actually laughed and felt a little sad the first time I watched that scene with my younger cousin — he was cheering the chaos until I explained that the minions were brainwashed. Gru’s crew always has this goofy, childlike loyalty to a master, and that loyalty never really shifts; it’s hijacked by science in this case. The movie makes the point that the purple transformation strips them of personality, and later they’re restored. So if you’re wondering whether the minions secretly wanted to join El Macho, the answer is no — they were forced into it and then redeemed by the end.