From Sahih Muslim (Hadith 6964):
Abu Ayyub Ansari reported that Allah's Messenger (ﷺ) said:If you were not to commit sins, Allah would have swept you out of existence and would have replaced you by another people who have committed sin, and then asked forgiveness from Allah, and He would have granted them pardon
Reference: Muslim 6964