You are correct. This is a trick. The website you visited had tried to sell you anti-virus software by making you think that your computer is infected. Having said this, there are indeed free antivirus programs that you can download, but you have to go to the correct websites to get it. There are many more sound-alike websites that would try to trick you into buying the program for a fee.
I am currently using the free AVG anti-virus on my Windows xp and it has been doing a very good job. I also have the free Spybot Search and Destroy software that can detect other malwares. Like I said, getting to the correct websites can be a bit tricky.