That's because of the meaning that the second sentence carries. "a los niños" means (in English): "to the children". So, it's an indirect modifier (M.I in Spanish). However, "los niños" in this sentence is used as subject of the sentence. That's why "los niños" is the correct way to say/write it.