It can be used in a variety of ways:
The person being addressed doesn't know how to answer the question.
Hm, good question! I have no idea, maybe you could try Googling it?
The person being addressed (usually teacher or lecturer) has been asked by a student. It doesn't matter if the question is obvious, saying "good question" is a useful way of keeping them engaged and confident to ask when they need help.
Good question, Mark! The Earth revolves around the sun and not the other way around.
When the question is thought provoking or well thought out.
Good question. I think the meaning of life is... what do you think?
When the person being asked is condescending.
Wow, good question. Like it wasn't totally obvious in the first place?
When you need a moment to reflect on your answer.
Good question. Hmm... well I suppose the answer would be 3.