Adam opened his eyes and saw all the angels prostrating before him except one being who was standing at a distance. Adam did not know what kind of creature it was that did not prostrate before him, nor did he know its name. Iblis was standing with the angels so as to be included in the command given to them, but he was not one of them. He was a jinn, and, as such he was supposed to be inferior to the angels. What is clear is that this prostration was to show respect and did not mean that the angels were worshipping Adam. Prostrating, in worship is done only for Allah.
Almighty Allah recounted the story of Iblis's refusal to prostrate before Adam: And (remember) when your Lord said to the angels: "I am going to create a man (Adam) from sounding clay of altered black smooth mud. So, when I have fashioned him completely and breathed into him (Adam) the soul which I created for him, then fall (you) down prostrating yourselves unto him." So, the angels prostrated themselves, all of them together. Except Iblis, - he refused to be among the prostrators. (Allah) said: "0 Iblis! What is your reason for not being among the prostrators?" (Iblis) said: "I am not the one to prostrate myself to a human being, whom You created from sounding clay of altered black smooth mud." (Allah) said: "Then, get out from here, for verily, you are Rajim (an outcast or a cursed one). And verily, the curse shall be upon you till the Day of Recompense (i.e. the Day of Resurrection)." Surah 15: 28-35
In another surah Almighty Allah recounted it thus: And surely, We created you (your father Adam) and then gave you shape (the noble shape of a human being), then We told the angels, "Prostrate to Adam" and they prostrated, except Iblis, he refused to be of those who prostrate.
(Allah) said: 'What prevented you (0 Iblis) that you did not prostrate, when I commanded you?" Iblis said: "I am better than him (Adam), You created me from fire, and him You created from clay." Allah said: "(0 Iblis) get down from this (Paradise), it is not for you to be arrogant here. Get out, for you are of those humiliated and disgraced." (Iblis) said: "Allow me respite till the Day they are raised up (i.e. The Day of Resurrection)." Allah said: "You are of those allowed respite." Surah 7: 11-15
Ibn Jarir reported that Muhammad Ibn Sirin said that the first one to reach a conclusion by reasoning was Iblis and that the sun and moon were not worshipped except through this method.
This means that Iblis tried to compare himself to Adam. He believed that he was more honorable than Adam. Therefore, he abstained from prostrating, even though Allah had commanded him to do so, just as He had commanded the angels. If an analogy is made, we see that Iblis is vain. For indeed, clay is better than fire because in it can be found the qualities of calmness, clemency, perseverance, and growth; whereas in fire can be found heedlessness, insignificance, haste, and incineration.
Iblis tried in vain to justify his refusal: "Shall I prostrate to one whom You created from clay?" (Iblis) said: "See? This one whom You have honored above me, if You give me respite (keep me alive) to the Day of Resurrection, I will surely seize and mislead his offspring (by sending them astray) all but a few!" Surah 17: 62
Adam was following what was happening around him and had feelings of love, awe, and astonishment. Deep love of Allah, Who had created and glorified him and Who had made His angels prostrate before him. Awe of the Creator's wrath when He excluded Iblis from His mercy. Adam was surprised by this creature, Iblis, who abhorred him without even knowing him, and who imagined himself better than Adam without having proved that he was worthier. What a strange creature Iblis was, and how strange was his excuse for not prostrating!
He (Iblis) imagined that fire is better than clay, but how did he get such an idea? Such knowledge is exclusive to Allah Who created fire and clay and Who knows which is the better of the two.
From the dialogue Adam realized that Iblis was a creature characterized by cunning and ingratitude. He then knew that Iblis was his eternal enemy. He was greatly astonished at Iblis's audacity and Allah's tolerance. Immediately after his creation, Adam witnessed the large amount of freedom that Allah gives to His commissioned creatures.