Antivirus software actively scans your device both for known and unknown threats. This includes viruses, ransomware, keyloggers, and trackers, all of which can be easily downloaded by simply clicking on malicious links or downloading and running what may seem like harmless files. While malware in the past often actively damaged your device, nowadays the incentive is mostly financial.
Modern antivirus programs have a huge database of verified malware signatures, which they use to compare newly-found files against. If they’re a match, the file is quarantined for potential deletion. More advanced antivirus software also uses AI and machine learning to detect threats that aren’t yet in the database, helping keep you protected against threats that aren’t even known yet.