Why is it wrong to say this sentence and what grammar rules are broken
If someone told you that
is wrong, the only possible reason is that that someone believes you should have said either:
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:
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:
The verb forget does not take an indirect object marked by at, whereas leave may.
the at home phrase is an argument of the verb, specifying its meaning. whereas in
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
For your meaning, either
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.