Well, Jasmine, let's jump right to the bottom line with the statement that whether you're looking for anti-virus, anti-spyware, or firewall software (and I assume you do want all three) there are free products out there in all categories that are solid options well worth considering. I think you are perfectly safe ignoring whether a product is free or is one you pay for when making a decision about what's right for you. Read the reviews, get advice from other users, do your due diligence in whatever way suits you, and then go with the product that you've decided best meets your needs, regardless of whether or not you have to pay for it. There is absolutely nothing inherently wrong with free software. Like commercial software it may be very good or simply awful!
That being said let's look at your questions. How do freebie companies make money? In a few cases they don't. Some, like the Linux crew, are simply doing it for the love of creating software. On sites with this type of software you'll often see the opportunity to make a donation to help pay their hosting expensees, but the software itself is always free. Like any other software it can be very good, very bad, or anywhere in between.
In most other cases the free software is put out there by commercial software enterprises. This freeware is usually a somewhat stripped down version of their commercial product. They make their money from people who try the free product, like it, but decide that the commercial version has enough extra features to be worth buying. So in one sense the free version serves as a trial before paying for the full version. In other words the company is offering you a free lunch, while hoping you'll choose to stay and pay for dinner. But in many cases you may decide the freeware is all you need. A close reading of the comparisons on the vendor's web site may show that the added features in the full version are not anything you particularly need. And it may even be, if you're not interested in managing lots of features, that the full version will be less to your liking than the freebie.
You also wanted to know whether the free products can really be as good as the commercial ones. As I've already indicated, there are good, bad and indifferent products in both camps. Whether or not you pay for it really is not the main issue. It is probably true, though, that you will get more features in a major commercial program. However, this can be a negative as much as a positive, as the big commercial companies have to keep adding new bells and whistles to their products to keep the new sales rolling. This leads to feature creep, which means software gets more and more complex, while not necessarily getting any better. Depending on what you're looking for, a major, feature-rich application may or may not meet your requirements.
There's also the third option, between free and pay, which is the time-limited free trial. This is commercial software that you will pay for if you want to use it beyond the trial period, but that allows you to run the full-featured product for a limited time, frequently 30 days. Unfortunately the well-known big names in the security field don't seem to offer this option (at least none that I know of). I recently purchased a full internet suite from one of the big names that had received a very good review here on C-Net. In my opinion it stunk, and it's no longer on my system, but they've got my money! Instead I am currently running a free firewall, an initially free anti-spyware program that I opted to pay for the full version, and a 30 day trial on an anti-virus program that I will probably buy when the trial period expires.
As you've probably noticed, I've avoided naming specific products, as my personal preferences may be just the opposite of yours. The most specific advice I'll give, from my own sad experience, is avoid buying a product you can't test drive, unless you're absolutely sure it's the one you want. With free or free-trial software your money stays in your pocket either forever or at least until you know for sure that this is the product you want. I do think that the major players have gotten too top-heavy and complacent, and taht there are some great new products out there that just might take them down a peg or two!
One final warning, though, on free software. Don't install anything on your computer unless you have verified from reviews on reputable web sites (such as this one) that it is safe and legitimate software. Then be sure to also download it only from its official site or a reputable download service. The net abound with so-called anti-spyware and anti-virus programs that are the exact opposite and are just waiting to infect your system. That being said, I hope you'll choose to investigate the world of free security software and free software in general. Good luck!