The teacher is right. If the speaker has already recovered from the flu, you cannot use the present perfect. The present perfect tells us about the present time, and at the time of speaking this person no longer has the flu. In this case, the flu ended, say, two days ago, so you need a past perfect. The past perfect takes us up to a time in the past (e.g. two days ago), while the present perfect takes us up to now.
One other problem is the word 'infected', which refers only to the moment when you caught the infection. (It also seems to be medically a bit doubtful, as flu is a virus rather than an infection. Infection suggests something bacterial. But I could be wrong. Let's not worry about that for the moment).
If you're talking about the period during which the speaker was ill, you'd use the simple verb 'have' - to have flu'.
Yet another problem is the fact that 'flu' is uncountable - you can't say 'a flu'. If you want to refer to a particular flu bug or flu 'episode' that you had, you could, for example, say 'a bout of flu'.
So, you could correct the sentence like this:
"I've just recovered from a bad bout of flu which I'd had since your birthday."