Time Machine is a built-in backup solution for macOS, and comes standard on every Mac.
I use Time Machine to backup to a portable hard drive that is disconnected from my computer when it’s not directly in use. By having an “air gap” between one of my backups, my computer has an archive available that cannot be corrupted, even if I’m infected by ransomware.
Time Machine allows you to roll back to a particular date that you created a backup, & even an individual file. This can’t be really useful if a file has been overwritten or corrupted and the corruption backed up. Simply go back to the date prior to the problem & recover an earlier edition of the file.