A Firewall can either be a piece of software or hardware. Firewall software is used to determine what incoming traffic is allowed or needs to be blocked from your computer. In order for this to occur your firewall has to look at every piece of information that tries to enter or leave your computer. If a site is trying to contact your computer and is not recognized by your firewall it will be blocked. You can customize what sites you'd like to have blocked, allowed or filtered and what products are allowed to run, and for advanced users what ports are open.
Windows 7, Windows 8, and Windows 10 computers have a built in firewall that is automatically enabled. It can be found in Control Panel -> Fire Wall.