The firewall normally blocks any attempt by a PC outside the firewall to initiate a connection to a PC inside the firewall. The firewall does not normally block a PC inside the firewall from initiating a connection to a PC outside (as the is the way it would normally browse the internet). The Teamviewer software running on a PC inside the firewall initiates the connection to the teamviewer server so is not blocked.