A firewall is a way to stop unwanted traffic from getting on your computer network.
Firewalls in non-computer use are walls in buildings that are designed to slow a fire down from getting to a different area. They have no openings in them as that would be way the fire travels to the new room. I have seen several major fires in buildings where firewalls protected and allowed the fire department time to save that part of the building.
Firewalls on computer networks work similar but have a couple differences. The object is just as in traditional firewalls to limit damage. A computer firewall has to have openings though. If it had no openings then an easier method would be to just disconnect your network from the Internet (pull the plug) and nothing could come in from the Internet. However that is not practical as you want to get some stuff on the Internet. For instance you probably want to allow people to see web pages (but then you may not and you could block in the firewall), to be able to get and send email and maybe go to certain private sites where you could do your banking or check on things at other locations.
The firewall is setup to block traffic on certain ports and to allow on others. It could be set either way. The ports are the channels that items connect thru on the Internet. Think of the ports as sorta like channels on a TV. It separates the different programs on TV or on the Internet keeps the conversations or requests straight. Web sites typically use port 80 and sending email uses port 25. There are 65.536 ports but we mainly use about 20 ports.
Firewalls can either be software or hardware firewalls. Software firewalls are what individuals use usually, although your DSL or cable modem has a limited firewall in it, and your router/switches have firewalls.
A software firewall is another program that you run on your computer that looks at all traffic coming in your computer and either approves or blocks the various packets. Most anti-virus programs you buy include firewalls, although the free versions of anti-virus programs usually do not include a firewall. Windows includes a free firewall with it that you can find in Control Panel and set it up from there. Zone Alarm makes a popular free firewall.
Hardware firewalls are firewalls that are built in boxes separate from your computer that monitor traffic. They can also function as routers on your network. These can cost hundreds of dollars to thousands of dollars. You will find larger businesses and government agencies using these. Barracuda is a popular maker of firewalls and Cisco and other networking companies make them also.
Firewalls will help make your network safer and can be easy to very complex to set up.