This term is taken from the world of fire-fighting, where a firewall is a barrier created to block the spread of a fire.

In computing, a firewall forms a barrier between a computer system (either a corporate system or a single consumer) and the outside world:

the aim is to prevent outsiders from gaining unauthorized access to the protected network.

The firewall monitors incoming and outgoing network traffic and decides whether to forward it or block it depending on the security policy that has been set.