Why is there free will for man
Since the intention of the Creator is to bestow goodness on His creatures, all the levels of creation were put in place so His kindness could emanate to them, yet in such a way that they would be able to receive it. Complete rigor will be the destruction of anything not perfect, while complete kindness will permit everything without restriction. However, these two aspects are necessary to make the guidance of kindness and justice and to give man the possibility of serving the Creator by their free will.
After the Shvirat HaKelim (breaking of the vessels) with the emanation of the lights of the name MaH (45) and BaN (52), G-od could have done the Tikun (repair) of all the worlds, but then, there would not have been a reason for the participation of man in this Tikun and a possibility to acquire merit.
For man to have a possibility to act and repair the creation, G-od restrained in a way, his outflow of kindness to this world, to give men the merit of doing the Tikun with their free will. It is by their free will to get closer to their Creator and learn His ways, that men merit their place in the higher worlds when they depart.