Bechirah Hachofshit, free will, is one of the most precious gifts given by God to mankind. But the core, the underlying heart of free will, lies in one's thoughts and desires; one's actions are just a follow-up.
Under normal circumstances, the things that you want to do, and the desires that you have, lead to whatever eventually happens. The exceptions are those absurd instances where the divine presence has to intervene; for example, the story of Purim. Hashem can't let one man's free will destroy His entire people. As I said, we are not judged on our actions, we are judged on what we want; and most of the time, what we want is what we are able to do.
There are instances, though, when we find that people have no free will, even though it seems like they do. Anybody can want to do anything. But whatever Hashem, who is King of the Universe, wants to happen is what will truly happen. We might interpret this description of Him as "king of the universe" loosely, but Hashem has the power to change the nature of mankind.
Yaakov loved Yosef the most of all of his sons. Why? Because the Torah said that he was "a child of his old age." What does this mean? Unkelos translates this to mean "a man who has the [equivalent] wisdom of Ya'akov in his old age." Yosef had the ability to understand very complex ideas, like an elderly scholar. He was on an elevated spiritual level, and wise beyond his years.
So Rav Nebentzahl asks a question: If Yaakov was able to pick up and appreciate Yosef's special gift, shouldn't his brothers have been able to appreciate and understand that he was special as well? After all, respecting your parents is one of the Ten Commandments; shouldn't the other brothers have taken their cue from their father and loved Yosef as well? But instead, they actually hated him. Also, if Yosef was such a great person, couldn't he have a judged his brothers favorably, instead of telling on them and reporting every evil thing they did back to their father?
These things are unfathomable and beyond reason. But here is where it gets crazy: in Gen. 37:14, when Yaakov sends Yosef to check on his brothers, it says he sends him from "the valley of Chevron". This is hard to understand, because the Gemara and Rashi both tell us that Chevron was on a mountain. So what does this mean, the valley of Chevron? Rashi says that the word emekcan also mean "deep." So rather than a literal valley, Yaakov intended it to mean: from the depth of the counsel, or the advice, of the righteous one, Abraham, who is buried in Chevron. At first glance, this makes absolutely zero sense.
Rav Nebentzahl gives a fascinating answer. A few parshiot ago, Abraham was promised that his descendants would be strangers in a strange land. Now, if you think about this logically, Jacob would never send his most beloved son, Yosef, who all of his brothers hated, to go and check up on them by himself. He would realize that Yosef would just come back with bad reports about his brothers, which would end up making the brothers hate him even more, making the situation even worse. Events would have to happen to cause Yaakov to choose the course he took. Clearly, Yaakov was guided to make decisions that were beyond his control.
Abraham was promised by God that his people were going to be strangers in a strange land. So Yaakov sent Yosef to go check up on his brothers, his brothers sold him into slavery, Yosef became second-in-command of Egypt and the Jews came there, inevitably making them strangers and slaves in the land. We see that when events like these need to happen, all control is taken from mankind. Yaakov, in his right mind, would never have chosen to put Joseph in that predicament. But the Jews needed to go down to Egypt, so Hashem made it happen.
Why does this specifically happen here? This was a lesson that we needed to be taught immediately before we went into exile. Things were going to happen that were going to make no sense at all, and we needed to be aware of the fact. We need to learn that not everything goes the way of nature. Because this was the formation of our nation, we were learning that God is directing the world, and what He wants, happens. In a perfect world, Yosef should've been loved; but he was hated by his own family. Yet in the house of Potiphar, Yosef was beloved, and then he becomes second-in-command of Egypt. How does that make sense? That is the least likely result. A slave--a Jewish slave--becomes second in command of Egypt.
But this is the most significant time for God to teach us that He truly runs the world. He showed us that sometimes, He's going to make things happen that are unnatural and out of the ordinary; but in the end, everything's going to work out because we are His people and He loves us, and He is always looking out for us.