As the titles imply.
The Gateway is a "GATE"
The Firewall is a "WALL"
A gateway is used by a computer network as a "gate/doorway" to access another network. It is usually a hardware device (router) with a specific network (IP) address that is used in the network configuration for those tasks that require access outside your local network such as another network or that worldwide network, the internet. If for any reason it is not working (hardware failure, incorrect configuration, etc.) you will see errors that the other network is "inaccessible".
A Firewall is a software and/or hardware device that acts as a protective wall between your device/network and the outside networks. It can be configured to let all traffic have inbound access or only certain traffic from specified networks or IP addresses. Some only protect from things trying to get in while others also can restrict traffic/communication going outward (like software or a virus trying to "call home"). This two way protection is best.
How they relate? Very different components. You will NEED a gateway to access other networks. You CAN function without a firewall but run the risk of intruders getting in to your network The best combination is a good firewall (I use Free ZoneAlarm) AND a good virus program (I use Free AVG).
Hope that helps.