Simon is epileptic: the first thing that happens to him in the whole novel is that he falls to the floor in a fit:
“He’s always throwing a faint,”said Merridew. “He did in Gib.; and Addis; and at matins over the precentor.”
Golding shows us Simon's symptoms one by one as he hallucinates that the Lord of the Flies is talking to him. So in this quote, his head tilts backward, his eyes fix, and he shakes:
Simon’s head was tilted slightly up. His eyes could not break away and the Lord of the Flies hung in space before him.
“What are you doing out here all alone? Aren’t you afraid of me?”
Then, Golding gives us the definite clue - that one of Simon's "times", one of his epileptic fits, was coming on:
Simon’s head wobbled. His eyes were half closed as though he were imitating the obscene thing on the stick. He knew that one of his times was coming on. The Lord of the Flies was expanding like a balloon.
Then the metaphor becomes clear. Simon is devoured by a "vast mouth", of an imaginary beast, but that mouth is a blackness, a darkness. It is, of course, no beast, but the "darkness of man's heart" which b rings about the fear and savagery on the island. Simon will indeed be devoured by it, when he comes down from the mountain.
Simon found he was looking into a vast mouth. There was blackness within, a blackness that spread.
“—Or else,” said the Lord of the Flies, “we shall do you? See? Jack and Roger and Maurice and Robert and Bill and Piggy and Ralph. Do you.
Simon was inside the mouth. He fell down and lost consciousness.
Simply - it's because he has epilepsy. Yet, figuratively, it is also a foreshadowing of Simon's eventual death at the hands of his friends.