According to Elizabeth's letter to Victor in which she informs him of William's death, William was simply playing hide-and-seek. Elizabeth had gone on a walk with Ernest, William, and her niece and mentioned that Ernest and William had gone off on their own. Elizabeth writes that after a while,
"Presently Ernest came, and inquired if we had seen his brother: he said, that he had been playing with him, that William had run away by himself, and that he vainly sought for him. . ." (Chapter 7, 58).
Of course, the Monster just happens to be in the nearby woods and runs into William. When William is rude to him because of his appearance, the Monster strangles the little boy.
There is not a great deal of significance to why William was hiding from Ernest other than to show that he is a typical, innocent little boy. Shelley might have set this part of the novel in the forest to demonstrate that because Victor has gone against nature, something as wonderful and didactic as the forest turns into a horrific murder scene. This would be in keeping with her Romantic emphasis in the rest of the novel.