Ok, so this doesn't have anything to do with cookies, but its still important. It is still part of security. Firewalls are barriers that are created between your pc and the internet. The function of the firewall is to scan all packets coming from the net, and deciding if it is going to give access to them. If the firewall finds that someone is trying to access you computer without your permission or trying to connect and read informartion about you, it will block it.
Firewalls also work the other way, they can prevent local programs from accessing the net.
Thus stopping trojans and other things that are running behind our backs. But as everything related with systems it is not perfect. Each different firewall has different weaknesses depending on how we set them up. There are other firewalls that work automatically, they might be better for the newbie, but they also have weaknesses. I recommend a nice firewall, not to hard to use, and gives you a lot of control.