(And they came upon a people devoted to some of idols. They said: "O Musa! Make for us god as they have gods." He said: "Verily, you are a people who know not. Verily, these people will be destroyed for that which they are engaged in. And all that they are doing is in vain.") 7:138-139 Then, Allah made a covenant with Musa of thirty nights after which He added to them ten more nights. Thus, they were forty nights in all. The covenant was that he was to fast these number of days, during both the day and night. Thus, Musa made haste to go to the Mountain and he left his brother, Harun, in charge over the Children of Israel. This is why Allah says,
فَأَخْرَجَ لَهُمْ عِجْلًا جَسَدًا لَّهُ خُوَارٌ (So he brought forth for them a calf, a body with a lowing sound. - 20:88) Some Commentators maintain that it was only a body without life and that the sound was produced by a special contrivance. But the majority of commentators believe that the calf in fact possessed signs of life.
فَقَالُوا هَـٰذَا إِلَـٰهُكُمْ وَإِلَـٰهُ مُوسَىٰ فَنَسِيَ (Then they said, "This is your god and the god of Musa, and he erred." - 20:88) Having carved a calf which could also produce a sound, Samiri and his friends said to the Bani Isra'il", "Here is your god and the god of Musa. It seems Musa (علیہ السلام) has forgotten, that is why he has gone elsewhere in search of god".
Tazkirul Quran
Maulana Wahiduddin KhanOn ayahs 86–88
When Almighty God informed Moses that his community had gone astray, he returned to his community very emotionally upset. He reminded his people that God had only recently showered His blessings on them and had revealed His many signs to them. So, how was it that they had forgotten everything so quickly and gone astray? Moses had gone to receive revelations from God for the Israelites and in the meantime the Israelites had started indulging in the worship of false deities at the instigation of certain misguided persons. This shows how deeply the polytheistic atmosphere of Egypt had influenced the Israelites and why it had become necessary to take them away from Egypt in order to restore them to the worship of the one God. Whatever Moses did with regard to Pharaoh was in connection with his dawah mission, and whatever he did with regard to the Israelites was in the context of safeguarding true religion. He performed both these tasks simultaneously. This shows the importance of both these tasks. If the Muslims had gone astray, dawah activity could not be stopped on that account and, similarly, if dawah work had to be done, it was not to be at the cost of internal reform.
Uthmani text of the Madinah mushaf (King Fahd Complex). Translation: Saheeh International. Tafsir via Quran.com.