Abi Musa Al-Shaarai narrated that Prophet Muhammad said: "Allah created Adam from a handful of dust taken from different lands, so the children of Adam have been created according to the composition of the land. Therefore, from mankind we have white, red, black and yellow ones; we have good and evil, ease and sorrow, and what comes in between them."
Ibn Masud and other companions of the Prophet said that Allah the Almighty sent Gabriel onto the earth to get Him clay therefrom. The earth said: "I seek refuge in Allah from your decreasing my quantity or disfiguring me." So Gabriel returned and did not take anything. And he said: "My Lord, the land sought refuge in You, and it was granted."
So Allah sent Michael for the same purpose, and the land sought refuge with Allah and it was granted. So he went back and said to Allah what Gabriel had said before him.
Then Allah sent the Angel of Death, and the land sought refuge in Allah. The angel said: "I also seek refuge with Allah from returning without carrying out His command." So he took clay from the face of the earth and mixed it. He did not take from one particular place, but rather he took white, red, and black clay (from different places).
The Angel of Death ascended with it, and He (Allah) soaked the clay till it became sticky. Then Allah said to the angels: "Truly, I am going to create man from clay. So when I have fashioned him and breathed into him (his) soul created by Me. Then you fall down prostrate to him. Surah 38: 71-72
So Allah shaped Adam into a human being, but he remained a figure of clay for forty years. The angels went past him. They were seized with fear by what they saw, and Iblis felt this fear most. He used to pass by the figure of Adam, buffeting it, which would make a sound like pottery. Allah told us: He created man (Adam) from sounding clay like the clay of pottery. Surah 55: 14
When the time drew near to breathe the spirit into Adam, as Allah the Almighty decreed, He commanded the angels:
'When I breathe My spirit into him prostrate before him." Allah breathed His spirit into Adam and when it reached his head Adam sneezed. The angels said: "Say all praise belongs to Allah." Adam repeated: "All praise belongs to Allah." Allah said to him: "Your Lord has granted you mercy." When the spirit reached his eyes, Adam looked at the fruits of Paradise. When it reached his abdomen Adam felt an appetite for food. He jumped hurriedly before the spirit could reach his legs, so that he could eat from the fruits of Paradise. Allah, therefore, said: Man is created of haste. Surah 21: 37
And then: The angels prostrated themselves, all of them together. Except Iblis - he refused to be among the prostrators. Surah 15: 31-32
Another version of the story relates that Allah took a handful of the dust of the earth and mixed into it the colors white, black, yellow, and red. That is the reason why men are born different colors. When Allah mixed the dust with water, it turned into potter's clay that makes a sound. It was fermented and had a smell. Iblis passed by, wondering what was going to be made of that clay. From the clay Allah created Adam. He molded his form with His own hands and blew His spirit into him. Adam's body quivered as life was imbued into it. Verily, His Command, when He intends a thing, is only that He says to it, "Be!"- and it is! Surah 37: 82
After this lesson about freedom, Adam learned another lesson, one about knowledge. Adam realized that Iblis was the symbol of evil in the universe and that the angels were the symbol of good. However, he did not yet know anything about himself. Then Allah made him perceive his true identity, the reason for his creation, and the secret of his glorification.
Allah the Exalted said: And He taught Adam all the names (of everything). Surah 2: 31
Almighty Allah granted Adam the power to know the natures of all things and to summarize them by names: that is a bird, that is a star, that is a tree, that is a cloud, etc. Allah implanted in Adam an insatiable need for and love of knowledge and a desire to bequeath knowledge to his children. This was the reason for his creation and the secret in his glorification.