Why is it wrong to say this sentence 'I'm afraid I forgot my homework at home

If someone told you that

I'm afraid I forgot my homework at home.

is wrong, the only possible reason is that that someone believes you should have said either:

I'm afraid I forgot my homework. I left it at home.

or

I'm afraid I left my homework at home.

The string "I forgot my homework at home" is ambiguous. When you were at home and supposed to be doing your homework, did you forget that you had homework to do? If so, then you should say:

I'm afraid that after I arrived home yesterday, I forgot that I had homework to do, so I didn't do it.

The problem is one of semantics, not grammar. Say what you mean and mean what you say.

However, most native speakers would understand your sentence to mean that you were claiming two things:

(1) I did my homework.

and

(2) I forgot to bring it with me. It's still at home.