Canned pineapple is more syrupy than fresh, so instead of the juice soaking into the surface of the cake and making it mushy, canned pineapple creates a layer of caramelization.
However, if fresh pineapple is all you have, give it a quick saute until it resembles canned pineapple — just make sure it isn't too hot when transferring it to your cake pan.