Allah, Exalted be He, says: "Behold, thy Lord said to the angels: 'I will create a vicegerent on earth.' They said: 'Wilt Thou place therein one who will make mischief therein and shed blood? Whilst we do celebrate Thy praises and glorify Thy holy (name)?' He said, 'I know what ye know not'" (Al Baqarah: 30)
Ibn Katheer states: This is a report from Allah to His angels explaining to them the wisdom behind creating Adam and his offspring, and how they will succeed each other on earth.
Allah says in another verse: "It is He Who hath made you (His) agents, inheritors of the earth: He hath raised you in ranks, some above others: that He may try you in the gifts He hath given you: for thy Lord is quick in punishment: yet He is indeed Oft-Forgiving, Most Merciful" (Al An'aam: 165)
He also says "Or, who listens to the (soul) distressed when it calls on Him, and who relieves its suffering, and makes you (mankind) inheritors of the earth? (Can there be another) god besides Allah? Little it is that ye heed!" (Al Naml: 62)
Allah tells that to His angels as a hint to the creation of Adam and his children, as He sets the scene for the occurrence of a great event before it actually takes place.
It is a great grace from Allah endowed upon Adam, as He created him with His hands, breathed soul unto him, taught him the names of all things and commanded the angels to prostrate themselves before him. Allah says: "When I have fashioned him (in due proportion) and breathed into him of My spirit fall ye down in obeisance unto him." (Al Hijr: 29)
Allah also says that it is He who created Adam and gave him shape and bade the angels bow down to him, and they did; except Iblis that refused to be among those who bowed down. Allah says:
"What prevented thee from bowing down when I commanded thee?' He said: 'I am better than he: Thou didst create me from fire and him from clay.'" (Al A'raaf: 11-12)
Imam Ahmad Ibn Hanbal reports that Abu Hurairah said that the Prophet, peace and blessings be upon him said: "When the son of Adam recites a verse of prostration and the prostrates himself (before Allah), Satan isolates himself, cries and invokes curses on himself and says, 'The son of Adam was commanded to bow down and he obeyed (his Lord), thus he will be destined to Paradise but I was commanded (by Allah) to prostrate myslef (before Adam) yet I disobeyed and thus I will be destined to Hell"
(Ibn Katheer. Stories of the Prophets)