This is the story of "The Fox and the Grapes."
This is the fable that the phrase "Sour Grapes" usually refers to. When someone is accused of "sour grapes" it means they work hard to find everything bad about something they can't have, just like the Fox said the grapes he couldn't reach were probably sour.