The novel is an allegory, which is a story that works on two or more levels of meaning.
There is the actual story of what happens to the boys on the island and there is the deeper level to the story with the moral message.
In The Lord of the Flies there is the look at different methods of government, the democratic government and the dictatorship, which was relevant at the time the novel was written after the end of the second world war, with Hitler’s dictatorship as well as those of Mussolini and Stalin.
The story is meant to give a lesson to its readers, which is the quality of a fable.
One of the messages could be that there is a dark side to all of us which, given the right circumstances, could come out.
Evil lurks in all of us.