There's several reasons that truckers do this. The primary reason that truckers leaving their trucks idling during the night is to regulate the temperature inside their truck while they are sleeping. Many times, the insulation of the cab is good enough that drivers can sleep comfortably in the cab of their truck.