Siddhartha's mother had a dream which was interpreted that if he stays in the palace he will become a great ruler and king. If he leaves the castle he will become a great spiritual leader. His father decides to keep him in the castle.
Siddhartha leaves the castle for the first time at 29 and sees an old man. Siddhartha realizes the results of aging.
He leaves the castle again and sees a sick man. He was surprised and troubled at the sight.
Again he leaves the castle and this time he sees a dead man. He realizes that everybody has to go through all of these sufferings.
Finally, he leaves the castle and sees an ascetic.
He decides to leave the castle and follow his example and try to reach enlightenment by meditating and fasting to discipline his body.