According to the Quran, Allah (God) has created the universe with a certain purpose, and all its parts are strictly under His control, carrying out His divine scheme without the slightest deviation.
Similarly, man has been created with a certain purpose. Yet man is completely free to do what he wants, and act upon his own decisions. However, in spite of this freedom, he is watched constantly by Allah, for He does not allow any such deviation over a long period that would nullify the plan of His creation.
Creation plan of Allah
The universe made by Allah is so vast that, despite the enormous progress made by human beings in their attempts to fathom the universe, many of its secrets still remain unknown. The planet Earth, made by Allah as part of the cosmos is unique in the entire universe, in that it has been endowed with an atmosphere and all the other factors, which are essential to make it habitable for man.
After creating a favorable world in the form of the Earth, Allah created the first man Adam (Adam), may Allah exalt his mention, and his feminine counterpart, Eve. Although the precise date of this event is unknown, it is a fact that the first pair of human beings to set foot on earth were Aadam, may Allah exalt his mention, and Eve.
Adam was the first man as well as the first Prophet. The way of Allah is to select a man as His Messenger from amongst human beings themselves, in order to send His revelations to humankind. Therefore, Allah revealed to Aadam, may Allah exalt his mention, through an angel the purpose of man's inhabiting the earth. According to this plan, Allah created a creature in the form of man, upon whom He bestowed freedom. Where the rest of the universe had no choice but to submit to the will of Allah, it is desirable for a man to opt for this divine plan of his own free will.
To learn more about this topic through this link.
The Islamic concept of history