Introduction to Routers and Routing

A basic question please: I understand the concept of gateway, i.e. if destination IP address is not in my subnet then go via gateway. But what does that packet look like, is the destination IP address that of the router and another/2nd destination IP address that of the intended end destination? Or asked differently if we have Sw1—Router—Sw2, where all hosts on Sw1 are in 192.168.1.0/24 and all on Sw2 are in 192.168.2.0/24, how will the Sw1 know that a packet with dest IP address for 192.168.2.2 needs to go to the router? -or does it learn MAC addresses in this instance from the router, which I assume is the case?