The first antivirus software for the PC became available by around the same time as when the first viruses started cropping up. The antivirus scans your computer for viruses and destroys these when found. It can look for any code that belongs to known viruses.
However, there are lots of new tools that are emerging every day and new antivirus software can't keep up. This is mainly because it doesn't get updated regularly but also because there's a lot of variation in what types of attacks it has to deal with. NOD, Norton, Kaspersky and Avast!, McAfee are all antivirus vendors that you may have heard of.