When you turn the engine off, the water pump stops pumping. The coolant thats in the motor absorbs the heat, and that reaches your temp sending unit.
You start the engine, the water pump starts pumping, and cooler water comes in from the radiator, bringing your temp gauge reading back down.