The Meccan people requested Allah's Messenger (ﷺ) to show them a miracle, and so he showed them the splitting of the moon.