( وَوَاعَدْنَا مُوسَىٰ ثَلَاثِينَ لَيْلَةً ) (And We made an appointment with Moses for thirty nights): Meaning that Allah (swt) has appointed for Prophet Moses (PBUH) a period of thirty nights.
( وَأَتْمَمْنَاهَا بِعَشْرٍ ) (and perfected them by [the addition of] ten): In another verse, Allah (swt) says:
وَإِذْ وَاعَدْنَا مُوسَىٰ أَرْبَعِينَ لَيْلَةً
(And [recall] when We made an appointment with Moses for forty nights.) (Al-Baqara: 51)
But here, Allah (swt) divides the forty days into thirty and ten days, while in the other verse, He (swt) mentions forty days. The reason behind this difference is that the appointed time for Prophet Moses (PBUH), as is mentioned in the books of interpretations, was originally thirty days. However, Allah (swt) intended to test and examine the people of Israel, whom were left by Prophet Moses (PBUH) with his brother Aaron (PBUH). Thus, Prophet Moses (PBUH) was delayed for ten days. During these ten days, they worshipped the calf, abandoned worshipping of Allah (swt), and disbelieved in Prophet Moses (PBUH). Thus, the detailed explanation for the forty days here has a goal and purpose – and Allah (swt) knows best. As the scholars stated, the additional ten days to the thirty-day period were to delay Prophet Moses (PBUH) and for the test to take place.
( فَتَمَّ مِيقَاتُ رَبِّهِ أَرْبَعِينَ لَيْلَةً) (so the term of his Lord was completed as forty nights): The word (term) refers to a specific time related to a particular activity, such as for the time set for pilgrimage. Allah (swt) has designated this appointed time, or term, which is forty nights.
( وَقَالَ مُوسَىٰ لِأَخِيهِ هَارُونَ ) (And Moses said to his brother Aaron): Prophet Moses (PBUH) intended to go and receive the revelation and the tablets from Allah (swt). So, he (PBUH) said to Aaron (PBUH):
( اخْلُفْنِي فِي قَوْمِي ) (“Take my place among my people): He (PBUH) told Aaron (PBUH) to be his successor among the people of Israel; that is to fulfil the duties that Prophet Moses (PBUH) used to perform.
( وَأَصْلِحْ وَلَا تَتَّبِعْ سَبِيلَ الْمُفْسِدِينَ) (do right [by them], and do not follow the way of the corrupters): The Messages of Prophets (PBUT) always aim to preserve righteousness and prevent corruption. Prophet Moses (PBUH) subtly signaled to Aaron (PBUH) by saying: (do right [by them], and do not follow the way of the corrupters) that there might be those inclined towards corruption, despite just being saved by Allah (swt) from Pharaoh and his soldiers. It is as if Moses (PBUH) revealed that there will be corruption, and so the most he asked his brother Aaron (PBUH) was that not to follow the path the of those who spread corruption. In fact, when Prophet Moses (PBUH) left them and went to the appointed place to meet Allah (swt), they turned to worship the calf.