Ash goes back to school because he wanted to. In the first episode of the Sun and Moon series, Ash and his mother go on vacation to the Alola region. There, Ash gets excited about seeing new Pokémon and visiting the Pokémon School. Since he loves Pokémon so much, the idea of learning even more about Pokémon appeals to him, so he decides to stay in Alola to learn at the school. There was no need for him to go back to school, but Ash always gets caught up in the excitement of whatever is going on and whatever interests him. So the reason he went back to school is because he wanted to go.
While it may seem unusual, there isn't anything terribly out of character here. Ash routinely gets caught up in excitement about competitions and festivals, particularly ones that have to do with Pokémon (which is most of them, if not all). One need only examine all the contests he's eagerly entered, which includes a bug-catching contest, various aerial sports, various races, a firefighting contest, filmmaking contests, and many more. In Sun and Moon Ash has already entered a pancake race, played a game of Pokémon Base, done a scavenger hunt, and competed in a Charjabug race. So other than the time commitment school takes, it isn't much of a change for Ash to get excited about school and enroll (and anyway, he apparently still has plenty of time to train, explore Alola, and take the island challenges).