Sailing under false colors means to sail under the enemy flag, and it was once a legitimate naval maneuver used to get close enough to the enemy for a surprise attack.
At the last moment, just before opening fire, the false colors were lowered and replaced by the ship’s “true colors.”
Although such deception is now considered dishonorable, we still say when someone we trusted reveals himself as the enemy that he is showing his “true colors.”
When someone we trusted turns against us, we also say he’s “shown his true colors”.