What is the meaning of "Good Grief"?
Solution 1:
Believe it or not, it's a bowdlerized version of "Good God!" (or "Good Lord!"), which is, in turn, a shortening of the liturgical response "Good Lord, deliver us" (from the hardship or vexation just mentioned in the Litany). In this case, it's a response to a clear and present bit of unpleasantness, often a mechanical device that won't co-operate or a vexatious person.
It's hard to imagine a world in which "Good Lord" would have been unfit for the tender ears of the listener, given what passes for ordinary conversation these days, but it was a concern at one time -- and the phrase's use by the Charles Schulz Peanuts characters has firmly fixed it in the lexicon of people of my generation.
It is an expression of exasperation, and informal.
Solution 2:
Good grief is an expression of annoyance or irritation. It's an informal expression. Typically you should say it when wearing an expression like this one: