In jail, Joseph interprets the dreams of 2 of the other prisnors. Latter on, the dreams came true. One of the prisnors was executed and the other one was released.
Pharaoh has a reoccurring dream that no one can interpret. The prisnor who got released remembered Joseph and how he can interpret dreams. He tells Pharaoh and Joseph is called to interpret his dream.
Can we please buy some of your grain, my lord?
Pharaoh's dream is about 7 fat cows and 7 skinny cows. Joseph says that the 7 fat cows represent 7 god years of harvest and the 7 skinny cows represent 7 years of famine. He tells Pharaoh to save up his grains during the good years so that they can be used during the famine.
Pharaoh is so happy with Joseph that he promotes him to be in charge of saving and collecting the grains. Joseph changes his name to Zapenath-paneah and becomes favoured by Pharaoh.
During the famine, Joseph's brothers come to buy some grains from him, not realizing who he is. Joseph however, immediately recognizes them.
Joseph then realises that they have left Benjamen home with Jacob. He tells the brothers to go back at get the youngest brother but he will hold Simeon hostage while they do so.