Why do we call a traitor a “turncoat”?

Someone who changes sides during a war is called a “turncoat” because of the actions of a former duke of Saxony who found himself and his land uncomfortably situated directly in the middle of a war between the French and the Saxons.

He quickly had a reversible coat made for himself, one side blue for the Saxons, and the other side white for the French. Then, depending on who was occupying his land, he could wear the appropriate colour of allegiance.