The moral of the story meaning is that message or lesson an author, movie maker, or other creator wants you to learn from their work. It is a bit different from a theme, though they can align. Theme is more the overarching idea that is used to direct and develop a literary work. A moral is more specific to a particular situation or group of people.
For example, the story of three hard-working brothers may teach that unity is more important than individuality. Or, the story of the crocodile and the monkey may have a moral that says that kindness can win over ferocity. These are both lessons that can be applied to our own lives.
Throughout history, writers have included morals in their stories, poems, plays, and novels. They often come across as preachy but, in reality, the intent is to help audiences or readers improve their lives through the insights presented in a fictional setting.
The moral of the story is usually stated at the end of a work, especially in children's literature. However, a moral can also be a theme, or it can be implied or hidden within a work. For example, Shakespeare's play Romeo and Juliet has a moral that shows the power of love over hatred. Marlowe's Dr. Faustus has a moral about the folly of selling one's soul. And Harper Lee's To Kill A Mockingbird has a moral about justice being served regardless of the color of a person's skin.