Mcp23017 getting very hot within seconds

Your PCB has been laid out wrong. This is the pinout of the part.
Pinout

Pin 1 is the top left hand corner as you look at it from the top side. That dosn't match your PCB layout.

No, that is very bad advice.