Preheat the oven to 350°F (175°C). Grease a 9x13-inch baking dish.
In a large bowl, combine the yellow cake mix, eggs, vegetable oil, and crushed pineapple (with juice). Mix until smooth.
Pour the batter into the prepared baking dish and bake for 30-35 minutes, or until a toothpick inserted in the center comes out clean.
While the cake cools, prepare the pudding by whisking together the instant vanilla pudding mix and milk. Refrigerate until thickened.
Once the cake is completely cool, spread the pudding evenly over the top.
Spread whipped topping over the pudding layer, and sprinkle with shredded coconut if desired.
Refrigerate the cake for at least 1 hour before serving.