It's a figurative expression that originated from the idea that when someone is scared, their skin might turn pale or yellowish due to a decrease in blood flow.
Here are some examples of how the saying is used:
* "He was all brave and boastful before the fight, but when he saw his opponent he turned yellow."
* "They thought he was a tough guy, but he turned yellow at the first sign of trouble."
The expression "turned yellow" is often used in a negative way to describe someone who is weak or lacking courage.