Aesop wrote a fable about a fox who wanted to eat some grapes hanging from a lofty vine. When he found he couldn't reach them, he said they must have been sour, anyway; hence, sour grapes.
"A famished fox saw some clusters of ripe black grapes hanging from a trellised vine. She resorted to all her tricks to get at them, but wearied herself in vain, for she could not reach them. At last she turned away, hiding her disappointment and saying: 'The Grapes are sour, and not ripe as I thought.'"
The Fox and the Grapes, by Aesop, translated by George Fyler Townsend
Image: PD Courtesy of Wikipedia