Ethernet frames are sent from one device to another on the network. Switches help this, by forwarding the frame to the right device.
Inside this layer-2 frame, is a source and destination MAC address. The source address is the MAC of the sender, whereas the destination address is the MAC of the device the frame is meant to reach.
When network traffic needs to get to another network, a router is needed to forward it on. When this happens, the destination MAC will be the router’s MAC.
The router then needs to forward this traffic to the next hop in the network. When it does this, it rewrites the source MAC as its own MAC. It also rewrites the destination MAC to be the address of the next hop.
This frame rewrite process happens at each router or layer-3 switch in the network.