The likely cause of this is you used too much oil, butter, or nonstick cooking spray when greasing the cake pan. The cake has to cling to the pan during baking when it's rising. If you greased it too heavily though the cake pulls away from the sides of the pan and then it will shrink while it cools. So don't over-grease the baking pan.