Legend says Emperor Taizong offered a concubine to his minister Fang Xuanling. Fang's jealous wife was given a choice: accept it or drink poison. She drank the 'poison' — which was actually vinegar (醋). Hence 吃醋 = jealousy.
usage
吃醋 specifically means romantic jealousy, not general envy. For general jealousy, use 嫉妒 (jídù).