a switch is a layer 2 device. this means that it operates on physical layer addresses.

a router is a layer 3 device. it operates on layer 3 addresses. it is used to separate networks.

a router maintains a list per interface that has layer 3 and matching layer 2 addresses.

when your pc sends an ip packet, the packet contains 4 pieces of information.
your layer 3 address
your layer 2 address
destination layer 3 address
destination layer 2 address

arp uses broadcast to find layer 2 addresses.

for packets that are going to a different network, the destination layer 2 address will have the mac address of the default gateway.