Here's why:
* Direct objects are the nouns or pronouns that receive the action of the verb.
* The verb in this sentence is "go," which means to move or travel.
* The students are the ones performing the action, so they are the subject.
* The place they are going to is the school, which is the object of the verb.
To make it clearer, you could rephrase the sentence as: "Students go to school." The word "to" functions as a preposition, and "school" is the object of the preposition.