He lived in luxury and was prevented from witnessing sorrow or suffering. While this was a privileged and usually pleasant existence, it was unreal. His encounter with suffering changed his perception of the reality of life and suffering.
First of all, He had an inquiring mind. Anyone delving into religious
dogma must have such a mind set, or they will just buy the farm.
Being shielded from daily affairs of the masses caused great
consternation when he saw the real world.
He searched his whole lifetime for truths that would improve
and elevate the lot of man
When the Buddha first traveled outside of his palace and witnessed human suffering, he became disillusioned with the life of luxury he led. He felt compassion for those who were less fortunate, and was thus compelled to reject the idea that people are born into low castes to suffer for the sins of their past lives.
Suttas where the Buddha questions the idea that suffering is caused by sins in past lives (he is speaking to Jains):
It was also this that led him to say:
Not by birth does one become outcast,
Not by birth does one become revered,
By deeds does one become outcast,
By deeds does one become revered.