I know that it's correct but I can't wrap my head around it . Seems to me that when we're talking about the present state we should use Present Perfect only when we're describing something that is happening right now (as in we ARE in that state, f.i.:"I have lost my keys"), or has connection to now. Shouldn't we just use Past simple here, "I was better" or "I'd been better"? I know I'm wrong, but why? I can't put my finger on usage of Present Perfect here.
The point you raise is that given the context of “the present state”, a reply to something like “How are you?” should also reference the present state.
However, this isn’t always how informal conversations go.
When someone says, “I have been better”, they aren’t describing their current state. They are describing a past state, with only an implied reference to the present. That is, the “How are you?” question is not answered, at least not directly.
The clue to the relevance of the answer lies in the comparative, “better”. Better than what? The obvious comparison is with the present. Naturally, if the past is better than the present, the present isn’t as good.
Grammatically, the alternatives you offer (simple past and past perfect) aren’t problematic, but idiomatically, they suggest a rather serious current condition. The present perfect idiomatically provides a happy median (if you’d pardon the pun) between “I’m fine” and “Help!”
-how are you? -I have been better.
I have been better. is a contraction of "There were occasions upon which I have been in a better state of health/mind than I am now."
Thus "I have been better" = "I am still somewhat ill/worried."
(The exact meaning of "better" will be determined by the context.)
"I was better" conveys the idea that you had recovered but that you have relapsed.
I have been happier - there have been occasions upon which I have been happier.
I was happy - I was happy but then my brother died and I became sad again.