The term “firewall” originally referred to a structure that was supposed to confine the fire in an enclosed space, thus hindering its spread and mitigating its harmful effects on humans and property.
By analogy, in network security, a firewall is a software or hardware system that functions as a gatekeeper between trusted or untrusted networks or even a part of them. It does this by filtering out harmful or potentially unwanted content and communication.
Network firewalls typically perform this function for internal systems with multiple devices or subnets. This type of firewall runs on network hardware and can easily be adapted for businesses of all sizes.
Host-based firewalls run directly on user (or endpoint) computers and can therefore offer much more personalized filter rules.
Most operating systems provide their own built-in, host-based firewall. However, these tend to feature only basic functionality and, as widespread as they have been, have probably been studied extensively by potential attackers.
The first commercial firewalls designed for computer networks were developed in the late 1980s by Digital Equipment Corporation (DEC). The technology rose to prominence and spread over the next decade due to the rapid growth of the global Internet.
More info: definition firewalls