Does Freedom mean doing whatever someone happens to want? If not, how should real freedom be understood?
Freedom means, Liberty of the person and the capacity of free will if it is legitimate.
According to the most common freedom understanding which we teach to our kids in the schoolbooks, A right, or power to engage in certain actions without interfering anybodies rights and privileges. That is to say, people are not free to interfere others rights.
Islam pictures a wider frame in this ground. It is also forbidden for one to damage him/her, and to be against him/herself. The body, the spirit, and the mind are all entrusted to him/her for a certain time. Moreover, man is not free to treason to this trust.
Man cannot commit suicide for this life is not his/her personal property. He/she cannot even cut his finger, how can he/she commit suicide. Yet one cannot use alcohol and drugs because he/she is not the maker of that mind.
Therefore, according to Islam real freedom is neither to harm ones self nor to harm others, and to use his/her will power within the limitations.
Considering that human is subject to Allah (swt), creation of Allah (swt), and he/she is not the one who rotates this world, he/she is not the one who make the seasons; a young lady in a spring day cannot go out with a dress as she wishes and excites others desires. As she does not have right to rebel to God, she does not have right to cause others to sin, to wound their souls, and to spoil their dreams.
Freedom has aspects concerning both the world life and the hereafter. Its aspect related with the hereafter is ones using his/her will power for both benefaction and harm as he/she wishes and his/her undergoing a trial in this world. Its aspect related with the world life is humans as a single species being in many fields of activity, having countless types of occupations. Humanity can exercise and has already exercised so many professions from carpentry to architecture, from being an artist to being a physician. Humans are free to study in any fields of science. They can do any good or any prayers as they wish. All these become manifest in the hereafter as separate heaven ranks for all believers. That is indeed missing a point if only recall heaven when it is said hereafter; there is also realm of hell. Rebellious souls who do not want to become bounds by any restrictions by miscomprehending the meaning of the freedom perform many sins and mutinies. And these cause the different stages of torments of the Hell.