Allegories are stories which teach a lesson. They have a hidden or symbolic meaning which parallel parts of the story with a teaching lesson behind them. These stories deal with constructs on two realms, one in the story, and the other in real life.
There is a bad form of interpreting Scripture which carries this name, “allegorizing Scripture” in which the true meaning of Scripture is interpreted in such a way as it is clouded. Many times insignificant elements of parts of the Scripture are torn from their narrative to mean something totally foreign and alien from the biblical context. While Scripture has allegories that are legitimate, many people twist and turn Scripture to mean things that Scripture really does not teach.
An example of a biblical allegory is Nathan’s confrontation of David in 2 Samuel 12:1-4. Jesus liked to use allegories in his teaching.
[Baker Evangelical Dictionary of Biblical Theology]