Why has Allah appointed some of the angels in charge of some affairs of the universe, even though He has no need of them?
Question

Why has Allah appointed certain angels to do tasks when he (s.w.t) can do it himself? Asking out of curiosity
Praise be to Allah.Firstly:
One of the basic principles of faith is belief in the noble angels, and belief that Allah, may He be exalted, has appointed each angel to do a certain task. That includes managing some matters of this universe. Allah, may He be exalted, says (interpretation of the meaning):
{And those who arrange [each] matter} [Az-Nazi`at 79:5].
Ibn Kathir (may Allah have mercy on him) said:
Regarding the words {And those who arrange [each] matter}, `Ali, Mujahid, `Ata’, Abu Salih, al-Hasan, Qatadah, ar-Rabi` ibn Anas and as-Suddi said: This refers to the angels. Al-Hasan added: They arrange [each] matter from the heaven to the earth; that is, on the command of their Lord, may He be glorified and exalted. There is no difference of scholarly opinion regarding that. (End quote from Tafsir Ibn Kathir, 8/313).
Shaykh ‘Abd ar-Rahman as-Sa‘di (may Allah have mercy on him) said:
{And those who arrange [each] matter} are the angels, whom Allah has appointed to arrange many matters in the upper and lower realms, such as rain, plants, trees, winds, seas, foetuses, animals, paradise, hell and so on. (End quote from Tafsir as-Sa‘di, p. 908).
Ibn al-Qayyim (may Allah have mercy on him) said:
Every movement in the heavens and on earth, including the movement of planets, stars, the sun, the moon, winds, clouds, plants and animals, is initiated by the angels who are appointed in charge of the heavens and the earth, as Allah, may He be exalted, says (interpretation of the meaning): {And those who arrange [each] matter} [az-Nazi`at 79:5] and {And the [angels] apportioning [each] matter} [adh-Dhariyat 51:4]. These verses refer to the angels, according to those who believe and follow the messengers (peace be upon them)…
The Qur’an and Sunnah indicate that there are different types of angels, and that they are appointed in charge of different types of created things. Allah, may He be glorified, has appointed angels in charge of the mountains, and has appointed angels in charge of the clouds and rain. He has appointed angels in charge of the wombs, who manage the affairs of the fertilised egg until its creation is completed, then He appoints angels to protect the person, and angels to record his deeds and write them down. He has appointed angels in charge of death, and has appointed angels to question the deceased in the grave. He has appointed angels in charge of heavenly bodies, who control their movements, And He has appointed angels in charge of the sun and moon. He has appointed angels in charge of hell to stoke its flames and punish its occupants, and He has appointed angels in charge of what happens in it. He has appointed angels in charge of paradise and what happens in it, who take care of its plants and rivers.The angels are the greatest of the troops of Allah, may He be exalted. (End quote from Ighathat al-Lahfan, 2/842)
Secondly:
Even though Allah, may He be exalted, has appointed the angels to manage some matters of His dominion, their management thereof is by His leave and His command, and they only do what they are commanded to do.
Ibn al-Qayyim (may Allah have mercy on him) said:
The word malak (angel) conveys the sense of a messenger who is carrying out the command of someone else. So the angels have no say in anything; rather the command belongs to Allah, the One, the Compeller, alone, and they carry out His command.
{They do not speak until He has spoken, and they act by His command.
He knows what is [presently] before them and what will be after them, and they cannot intercede except on behalf of one whom He approves. And they are filled with reverent awe of Him} [Al-Anbiya’ 21:27-28]
{They fear their Lord above them, and they do what they are commanded} [An-Nahl 16:50]
{they do not disobey Allah in what He commands them but do what they are commanded} [At-Tahrim 66:6].
They only descend by His command, and they do not do anything except after He has given permission. They are honoured slaves of His. Some of them are the [angels] lined up in rows and some of them are those who glorify Him. There is no one among them but he has an assigned place, beyond which he does not go, and he does the task that he was commanded to do, without falling short or overstepping the mark. (End quote from Ighathat al-Lahfan, 2/843).
Thirdly:
One of the things that are definitively proven in Islam is that Allah, may He be exalted, does not do anything except on the basis of ultimate wisdom, whether He has informed us of that or has kept knowledge of it to Himself, may He be glorified and exalted.
Shaykh Ibn ‘Uthaymin (may Allah have mercy on him) was asked about the wisdom behind the creation of the jinn and humankind, and he (may Allah have mercy on him) replied:
Before I speak about this matter, I would like to point out a general principle regarding what Allah, may He be glorified and exalted, creates and what He prescribes.
This principle is taken from the verses (interpretation of the meaning)
{and He is the Knowing, the Wise} [at-Tahrim 66:2] and {Indeed, Allah is ever Knowing and Wise} [an-Nisa’ 4:11], and many other verses which affirm that Allah is wise in what He creates and in what He prescribes – that is, in His universal decree and His religious decree. There is nothing that Allah, may He be glorified and exalted, creates but there is wisdom behind it, whether that is when bringing it into existence or when taking it out of existence.
And there is nothing that Allah, may He be exalted, prescribes except there is wisdom behind it, whether that is making something obligatory or prohibited or permissible.
But this wisdom on which His universal decree and religious decree are based may be known to us or it may be unknown, or it may be known to some people and not others, commensurate with the level of knowledge and understanding that Allah, may He be glorified and exalted, grants them. (End quote from Majmu` Fatawa ash-Shaykh Ibn `Uthaymin, 1/87).
Fourthly:
The perfect nature of the wisdom of Allah, may He be exalted, is something that is well established and well known to every Muslim, and submitting to it is one of the fundamentals of faith.
Imam ash-Shafa`i (may Allah have mercy on him) said: Allah enjoined His Prophet (blessings and peace of Allah be upon him) and all other creatures to worship Him in whatever way He willed, as was stated by His Prophet. No one has the right to question why or how, or add his own view to what was narrated from the Messenger of Allah (blessings and peace of Allah be upon him). (End quote from al-Umm, 10/16).
Knowing that motivates the Muslim to focus on purifying himself and not let himself be distracted by giving his view on issues that do not bring any benefit; rather they lead to going to extremes in doubts and expose him to intrusive thoughts (waswasah).
Ibn Abi’l-‘Izz al-Hanafi (may Allah have mercy on him) said:
You should understand that the basis of servitude and belief in Allah and His Books and His Messengers is submission and not asking about the details of the wisdom behind the commands, prohibitions and other divine laws.
Hence Allah, may He be glorified, did not tell us that any nation that believed in its prophet and believed in the message he brought to them ever asked him about the details of the wisdom behind what he enjoined them to do and forbade them to do, and what he conveyed to them from their Lord. If they had done that, they would not have been believers in their prophet; rather they accepted the teachings, submitted and surrendered.
Whatever they learned of the wisdom behind rulings is what they learned, and whatever was hidden from them, their submission and surrender did not depend on knowing that, and the nation never thought that finding out about that wisdom was any of their concern, for they thought too highly of their messenger to ask him about that.
Hence the early generations of this ummah – which is the most perfect of nations in terms of mature thinking, knowledge and understanding – did not ask their Prophet (blessings and peace of Allah be upon him): Why did Allah enjoin such and such? Why did He forbid such and such? Why did He decree such and such? That was because they knew that asking such questions is contrary to faith and submission, and they could not remain steadfast in their commitment to Islam unless they surrendered…
Allah, may He be glorified and exalted, is not to be questioned about what He does, because of the perfect nature of His wisdom, mercy and justice, not merely because of His might and power. (End quote from Sharh at-Tahhawiyyah, p. 261-262)
Allah, may He be exalted, says (interpretation of the meaning): {And your Lord creates what He wills and chooses; not for them was the choice. Exalted is Allah and high above what they associate with Him} [al-Qasas 28:68].
For more information, please see the answer to question no. 186418.
Fifthly:
When the Muslim reflects on the actions of the angels, some aspects of the wisdom of Allah, may He be exalted, will become apparent to him.
Allah’s creation of the angels and their deeds confirms the perfection of His lordship and His divinity. So when the Muslim learns about the immense size of these angels and their large numbers, and the tasks to which they are appointed, yet despite that not one of them disobeys Allah’s command in the slightest – rather they race to obey Him, may He be glorified and exalted – that is indicative of the perfect lordship and divinity of Allah, may He be exalted.
If the great number of troops and workers of a king in this world is indicative of his perfect sovereignty and control, and is indicative of the high level of obedience that his subjects show him, then in the case of Allah, may He be exalted, this meaning is demonstrated more clearly by His creation of the noble angels. Allah, may He be exalted, says (interpretation of the meaning):
{And they say, “The Most Merciful has taken a son.” Exalted is He! Rather, they are [but] honored servants.
They do not speak until He has spoken, and they act by His command.
He knows what is [presently] before them and what will be after them, and they cannot intercede except on behalf of one whom He approves. And they are filled with reverent awe of Him.
And whoever of them should say, “Indeed, I am a god besides Him” – that one We would requite with Hell. Thus do We requite the wrongdoers} [Al-Anbiya’ 21:26-29].
Moreover, for the one who studies the texts of the revelation concerning the existence of the angels and the tasks to which they are appointed, that will instil in him perfect fear of Allah, may He be exalted, and at the same time will instil in him perfect love and hope.
If he studies the texts of the revelation that speak of the angels of punishment and those who write down people’s deeds, that will increase him in fear of Allah. In contrast, if he studies the texts of the revelation that speak of the angels of mercy and the guardian angels, that will increase him in love for his Lord and hope of His forgiveness. All of this leads to attaining the level of faith that is enjoined upon people.
Allah, may He be exalted, says (interpretation of the meaning):
{Only those believe in Our verses who, when they are reminded by them, fall down in prostration and exalt [Allah] with praise of their Lord, and they are not arrogant.
They arise from [their] beds; they supplicate their Lord in fear and aspiration, and from what We have provided them, they spend} [As-Sajdah 32:15-16].
Shaykh Ibn ‘Uthaymin (may Allah have mercy on him) said:
Belief in the angels leads to great outcomes, including the following:

Knowledge of Allah’s greatness, power, might and authority, for the greatness of the created being is connected to the greatness of the Creator.
Gratitude to Allah, may He be exalted, for His care towards the children of Adam, as He has appointed some of these angels to protect them, record their deeds and do other things that are in their interests… (End quote from Majmu` al-Fatawa, 6/89).

And he (may Allah have mercy on him) said regarding the wisdom behind the creation of the noble scribes (the recording angels), even though Allah, may He be glorified and exalted, knows all things and nothing that we do in secret or in public is hidden from Him:
The wisdom behind that is that it highlights the fact that Allah, may He be glorified and exalted, has created all things in a system, according to estimates and calculations, and He has perfected it to the extent that He has appointed noble scribes to record the words and deeds of the children of Adam, who write down everything that they do, even though Allah, may He be glorified and exalted, knows what they will do before they do it.
But all of that serves to highlight how perfect is the care of Allah, may He be glorified and exalted, for man, and it highlights the fact that this universe is put together in the best order and is perfectly designed. (End quote from Fatawa Nur ‘ala ad-Darb, 1/185).
And Allah knows best.