AND HE MADE HIMSELF STRANGE TO THEM. (Braishis 42:7)
For this behavior, Joseph perhaps had a number of reasons. But the most important reason was the following: Joseph had been intended by Hashem as the leader of the house of Israel in Egypt, so that the newly developing nation should grow under his wise and capable leadership to become the people of G-d and to receive the Torah.
Had Joseph made known to his father that he was alive in Egypt, the brothers would never had bowed to him or been subservient. Even had the family come to Egypt when Joseph had already gained power, the brothers would have looked upon him as the younger brother and they would not have yielded to his leadership. But when they came as supplicants before the vice-regent of Egypt, and they had been accused by him and had become full of dread and had bowed to him and had entreated him, then when he revealed himself to them they no longer could look down upon him as a younger brother.
...and therefore the dreams would be fulfilled
Thus they were conditioned to revere him and to accept his sovereignty over them, thereby assuring his leadership over the house of Israel, which G-d had intended in order to create a holy nation. Now, therefore, Joseph began the process of shaking his brothers and intimidating them, so that when he would finally reveal himself to them they should look upon him not as a younger brother but as an all-powerful ruler, and therefore the dreams would be fulfilled.
The purpose of the dreams was to foretell that the future of this great family depended on the leadership of the virtuous Joseph, who for 71 years would wield absolute power over them and thereby shape them into the people of the Torah. — The Beginning