There is a class of Japanese verbs (and more generally, predicates) whose subjects and objects take が. For example:
- あの学生がその本が要る。(Ano gakusei ga sono hon ga iru. "That student needs your book.")
- 猫が魚が好きだ。(Neko ga sakana ga suki da. "Cats like fish.")
- 私が日本語が分かる。 (Watashi ga nihongo ga wakaru. "I understand Japanese.")
(Of couse, these がs can be replaced with は, も, etc. depending on the sentence.)
What is the difference between these verbs and verbs whose objects are marked by を? Volition. From my textbook:
These relate to conditions or occurences which come about apart from human decision, will, or volition, such as understanding, needing, or being able.
You cannot help understanding Japanese — you just do. Thus, 「日本語」 is not something you are doing something to, and does not take を.
Edit: I should add that in modern colloquial Japanese, sometimes the object of these verbs takes を, which changes the focus of the sentence a little. See my answer to this question.
 My textbook (Japanese: The Spoken Language) calls these "double-ga predicates" or "affective predicates," contrasted with "operational predicates." I am not sure what other names they go by.