U1 is a PTC type thermistor. At lower temperature its resistance is low. R1 is to be selected carefully such that at lower temperatures the voltage across U1 is not enough to satisfy the requirement of Q1 to turn on. D1 is also added to provide an additional diode drop to further control the turn on/off of the circuit. It may or may not be needed depending on the design. At lower temperature the Q1 is off and the relay coil won’t be energized and the lamp will not turn on.
Once the temperature increases the resistance of U1 also increases and its voltage drop until it reach the VBE requirement of Q1 to turn on. Once q1 turns on, the relay coil will be energized and the lamp will turn on.