Why is it wrong to say this sentence and what grammar rules are broken
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.
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.
(2) I forgot to bring it with me. It's still at home.
The verb forget does not take an indirect object marked by at, whereas leave may.
I left my homework at home.
the at home phrase is an argument of the verb, specifying its meaning. whereas in
I forgot my homework at home.
it is not, and can only be an adjunct: specifying where the action took place, not being part of the meaning of the action. Furthermore, forget in the special sense of leave behind (as opposed to forget about) is not really compatible with such a locational phrase.
As Frustratedwithformsdesigner says, the second sentence is understandable in context, but it is not something that a native speaker would say, except in the rather unusual meaning where at home is an adjunct; something like
I was thinking about my homework all the time I was at the gym, and then on the bus, but I forgot my homework at home.
For your meaning, either
I forgot my homework. or I left my homework at home. would be the normal ways to express it.
When I look at this, the way I see it as being wrong is that you left out the word "that": "I'm afraid that I forgot my homework at home."
Without the "that," you technically have two complete sentences: "I'm afraid." "I forgot my homework at home." This is technically a run-on.
Although, in informal English, I'd say this is fine.