Breakdown of nihongo ga wakaranakute, sensei ni shitsumon o shimashita.
Questions & Answers about nihongo ga wakaranakute, sensei ni shitsumon o shimashita.
が marks the thing that is understood or not understood with the verb 分かる.
In Japanese, 分かる behaves like to be understandable / to be clear rather than to understand (something). Because of that, the thing that is clear / not clear takes が, not を.
日本語が分かる。
Japanese is understandable. / I understand Japanese.日本語が分からない。
Japanese is not understandable. / I don’t understand Japanese.
If you said 日本語を分からない, it would sound unnatural or incorrect in standard Japanese. With 分かる, always use が for the thing understood / not understood.
Both are possible, but the nuance changes.
日本語が分からなくて…
Focuses on Japanese as the specific thing you do not understand.
It often answers an implicit question like What is it that you don’t understand? → Japanese (is what) I don’t understand.日本語は分からなくて…
Uses 日本語 as the topic (what you’re talking about in general).
It can suggest a contrast, like: As for Japanese, I don’t understand it (but maybe I do understand something else).
In your sentence, 日本語が分からなくて、先生に質問をしました。, が is completely natural and common. は is grammatically fine, but it adds a bit more of a contrastive or topic-like feel: As for Japanese, I didn’t understand it, so I asked the teacher.
