Joseph was a young lad, and his brothers were envious of his father’s affection for him.
When Joseph informed them about his goals of prominence, they became even more envious of him. As a result, they attempted to sell him as a slave in order to get rid of him. He ended up as an Egyptian prisoner.
But God was with Joseph, and he was given a particular ability and wisdom that allowed him to not only get out of prison, but also to save the entire country of Egypt and neighbouring countries from starvation.