The MOSFET has a resistance. When current flows from the MOSFET's drain to its source, there will be a voltage drop. Multiply that current and voltage to get the power loss. That lost power becomes heat.