Abbas - Tanwîr al-Miqbâs min Tafsîr Ibn ‘Abbâs
(And when We appointed for Moses forty nights) by giving him the scripture, (and then you chose the calf), you worshipped the calf, (when he had gone from you) to the mountain, (and you were wrong-doers) harmful both to yourselves and others.
And when We appointed for (wā‘adnā or wa‘adnā) Moses forty nights, at the end of which We shall give him the Torah for you to implement, then you took to yourselves the calf, the one which the Samaritan fashioned for you as a god, after him, that is, after he departed for Our appointment, and you were evildoers, for taking it [in worship], because you directed your worship to the wrong place.
And when We appointed for Moses, after concluding his struggle against Pharaoh's folk and destroying them, forty nights, during which he will devote himself exclusively to Us so that the natural coverings that had veiled his heart from the nature of light would be lifted during the forty [days] in which his body was being created out of the fetal form and while he was veiled as a result of this formation from [his] primordial nature - as reported in a ḥadīth: 'He fermented the clay from which Adam was made in His hand for forty mornings' - [and] from his heart's aspect, and so that the wisdom of the Torah should emerge from his heart and manifest itself upon his tongue; then you took to yourselves [the Calf after him], the calf of the deficient animal soul as a god after his separating himself from you and his absence from you; and you were evildoers, assigning worship where it does not belong.
Allah then said, "Remember My favor on you when I forgave you for worshipping the calf.'' This happened after Musa went to the meeting place with his Lord at the end of that period which was forty days. These forty days were mentioned in Surat Al-A`raf, when Allah said,
(And We appointed for Musa thirty nights and added (to the period) ten (more)) (7:142).
It was said that these days were during the month of Dhul-Qa`dah plus the first ten days in Dhul-Hijjah, after the Children of Israel were delivered from Fir`awn and they safely crossed the sea. Allah's statement,
وَإِذْ ءَاتَيْنَا مُوسَى الْكِتَـبَ
(And (remember) when We gave Musa the Scripture) means, the Tawrah,
(And the criterion) that is that which differentiates between truth and falsehood, guidance and deviation.
(So that you may be guided aright), after escaping the sea, as another Ayah in Surat Al-A`raf clearly stated,
(And indeed We gave Musa ـ after We had destroyed the generations of old ـ the Scripture (the Tawrah) as an enlightenment for mankind, and a guidance and a mercy, that they might remember (or receive admonition)) (28:43).
Maududi - Sayyid Abul Ala Maududi - Tafhim al-Qur'an
When after their escape from Egypt the Israelites entered the Sinai Peninsula, Allah invited the Prophet Moses to Mount Tur for forty days and forty nights to give him Laws, Instructions and Commands for the guidance of the people who had recently been liberated from slavery. (For details, please see Exodus, chaps. 24 to 31). It should, however, be noted that the Tur, referred to here, is not the modern port of Tur on the eastern shore of the Gulf of Suez.
Cow-worship was very common in Can'an, Egypt and the neighbouring countries. When the Israelites degenerated and became slaves of the Copts after the death of the Prophet Joseph, they learnt this evil practice too from their rulers along with other evils. (The incident of the calf-worship is given in detail in Exodus, 32).
And when We appointed for Moses forty nights then you took to yourselves the calf after him and you were evildoers. What a difference [there is] between one community and another! When Moses عليه السلام withdrew from the community for forty days they took the calf as their object of worship and were pleased with that. They said This is your God and the God of Moses but he has forgotten [20:88]. [On the other hand] the community of Muḥammad the Chosen ﷺ spent many years with their prophet. If they had heard anyone mention any form of [material] description of what they worshiped they would not have spared their last breath and would have given their lives [before agreeing to such a comparison]. It is said that Moses عليه السلام entrusted his community to his brother saying Take my place with my people [7:142]. When he returned he found that they had fallen into temptation fitna. Our Prophet ﷺ relied on God and did not suggest anyone to lead the community. At the end of his life he said “the highest companions.” See how the Real attended to the care of [Muḥammad's] community in preserving their monotheism. By my life they may forfeit their [territorial] borders but they will not compromise their declaration of God's unity tawḥīd.