The Children of Israel worshipped the Calf
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).
[وَإِذْ قَالَ مُوسَى لِقَوْمِهِ يَـقَوْمِ إِنَّكُمْ ظَلَمْتُمْ أَنفُسَكُمْ بِاتِّخَاذِكُمُ الْعِجْلَ فَتُوبُواْ إِلَى بَارِئِكُمْ فَاقْتُلُواْ]
(54. And (remember) when Musa said to his people: "O my people! Verily, you have wronged yourselves by worshipping the calf. So turn in repentance to your Creator and kill yourselves (the innocent kill the wrongdoers among you), that will be better for you with your Creator.'' Then He accepted your repentance. Truly, He is the One Who accepts repentance, the Most Merciful.)