You were not [O Prophet] on the western side [of the mountain] when We gave Moses Our commandment, nor did you witness that event1.
Footnotes
[1]
The pagans of Makkah are recurrently reminded in the Quran that the Prophet (ﷺ) did not witness any of these events that happened centuries before his birth. See 12:102, 3:44, 11:49. So the only logical way of knowing about these stories is the divine revelation.