Meaning
To switch sides / To turn one's coat
Example
Só porque o time dele estava perdendo, ele virou a casaca!
Just because his team was losing, he switched sides!
Origin
Once an English expression for joining a political party out of opportunism, it became common in 20th-century Brazilian political coverage during periods of party-switching ('trocar de partido' / 'dar uma virada'). The Portuguese 'virar a casaca' (literally 'turn the coat') tracks the English 'turncoat.'
Source: Etymonline — turncoat.
Practice idioms with the Idiom Trainer
Falando's Idiom Trainer teaches you to recognize idiom meanings and create sentences using them, so you can speak like a Brazilian.
More idioms
Acertar na moscaTo guess correctly / To hit the nail on the headAmigo da onçaA fake/false friendAndar na linhaTo toe the line / To behave properlyArmar um barracoTo cause a public sceneRodar a baianaTo cause a public scene / To go ballisticArrumar sarna pra se coçarTo ask for troubleArrastar as asasTo hit on someone / To flirtAbrir o jogoTo come clean / To open upArregaçar as mangasTo roll up one's sleeves / To get to workAgarrar com unhas e dentesTo hold on for dear life / To seize an opportunity