What does this phrase mean? And in what cases is it appropriate to use it?
- "X is good for you." This just means something is healthy for you, beneficial for you, etc.
- "Good for you!"
- This can be used in seriousness, such as Bruno said. It can either mean "Congratulations!" and "That's great!", or as a word of praise.
- The phrase can also be used sarcastically, especially if delivered with an overly enthusiastic tone. In this case, it carries the connotation of, "Wow, that's great. Do you want a pat on the back or something?"
Definition from Cambridge Dictionaries Online:
Good for you! (Australian also Good on you!)
used to show approval for someone's success or good luck.
You passed your exam - good for you!
Two additional examples that I extracted from the COCA:
I don't think you would want to know either. Good for you for not knowing.
He's going to make lots and lots of money! Good for you, congratulations!
Good for you is usually used to express approval toward a person, but in some contexts it has a different meaning.
I'm taking my driving test next month.
Good for you!
I have a new car.
Good for you.
The meaning of the more generic phrase good for is "having a advantageous effect on".
Eating spinaches is good for you.