I am confused between these two sentences and could not identify which one is correct to say.
Generally, when I am at home, I am doing my homework.
or
Generally, when I am at home, I do my homework.
Both are perfectly grammatical and normal. They have subtly different meanings, but (as is often the case for questions about the so-called tenses in English) the difference is not in the objective events described, but in how the speaker is choosing to relate to them temporally.
The second "When I am at home I do my homework" is a plain statement, using the so-called "present" I do, which usually has a habitual sense, appropriate here.
The first "When I am at home I am doing my homework", it is focusing on a (typical) occasion when I am at home, and imagining the experience of engaging in homework.
One possible implication of the second is that doing homework takes up a lot of my time at home, so that it seems to me that all the time that I am at home is taken up by homework. This is not the only possible reason for choosing the continuous, but it is one possible meaning.