There are many different antivirus softwares out there. One is Norton. This is probably the most well-known within the United States of America. Another is the Windows Defender, part of Windows 10. This one works well. While there are plenty of others that could be named, they all work in the same way. So, instead of naming more, I’ll talk about how an antivirus software works.
The first thing that an antivirus software does is run periodic checks on your computer. It’ll learn what’s normal and what’s not for your specific device it runs on. If there is something out of the ordinary, or if you’ve opened an attachment since the last check. It’ll point out a virus, and most will correct the issue without you having to lift a finger. If it’s a large issue that the system cannot fix by itself, it’ll give you some steps to help.