When you send a data packet from a source to a destination through a router, the data packet goes through the data link layer twice. First, when the data packet leaves the source and is transmitted to the router, it is wrapped in a special envelope called a "frame" using protocols like Ethernet. This frame is then sent over the physical link to the router.
Once the frame reaches the router, the router "unwraps" the frame and examines the contents of the data packet at the network layer to determine where it should be forwarded. Then, the router creates a new frame using data link layer protocols and encapsulates the data packet into this new frame. This new frame is then sent out of the appropriate interface toward the destination.
So, in total, the data packet passes through the data link layer twice: once when it leaves the source and once when it is transmitted from the router to the destination.