An allegory is an extended metaphor in which characters and/or symbols refer to abstract things, stories, or real aspects of human life. For instance, Ralph is an allegory for a real life democratic ruler who is ineffective because the community devolves. Jack is an allegory of the typical dictator who rules by fear and intimidation.
Golding used R. M. Ballantyne's 1857 novel The Coral Island as a basis for this story. In Ballantyne's book, some boys are stranded on an island and the only threat is external: cannibals. But in Golding's novel, the threat is internal: the boys themselves. Unlike Ballantyne's group of civilized boys who remain reasonable, Golding shows that these so called civilized, British boys are capable of devolving into savages. He calls attention to the fact that even civilized people can resort to barbarism and violence. So, whereas the British boys in Coral Island only feared the cannibals, the boys in Lord of the Flies have only to fear themselves. This is an allegory of the state of the world following World War II. With the ongoing threat of nuclear war, there is always the danger of such a thing occurring. In this case, Golding's novel is a political allegory of the world following World War II. This is a world that proved its capability for violence in that war and the subsequent Cold War keeps the threat of violence alive.
It it also a psychological allegory in Freudian analysis. Jack is the "Id," that which is responsible for desires, impulses, and seeking gratification regardless of ethics or human sensibility. Piggy is the Superego, the censor of the Id. The superego monitors the Id and tries to control its impulses. Ralph represents the Ego, that which mediates between the Id and the Superego.
The novel is also a Biblical allegory. Here we have a group of people placed in a paradise. It is up to them to work together and avoid the temptation to do any evil or go against God's moral and ethical lessons. Like Adam and Eve in the story of the Garden of Eden, the boys (lured by Jack, a devil figure) disobey moral codes of conduct by giving in to baser impulses.