Short answer
A firewall protects by allowing wanted traffic and blocking traffic that should not reach the system.
Firewall in the router
The router firewall normally stops unwanted incoming traffic from the internet to the home network. This is an important baseline setting.
Firewall on the computer
The operating system firewall can block traffic between local apps, networks and the internet. It should stay active even behind a router.
Rules and logs
A good firewall has clear rules and logs that help with troubleshooting. Too many exceptions weaken protection.
Common questions
Do I need a firewall if I use VPN?
Yes. VPN encrypts traffic but does not replace a firewall.
Should I turn off the firewall when something breaks?
No, troubleshoot specific rules or programs instead.