I would suggest opening the unit to see where the pins in that socket are connected to. Or. open up the handpiece and see where the wires go.
You'll have two wires for the heater element (AC voltage, most likely 24..28v or ~12v) , one wire is most likely earthing and one wire should be the temperature sensor.
If you don't want to open up the unit, you could use a multimeter... place a lead on something you know it's ground (ex the negative of the fan inside the handpiece for hot air gun) and then use the other probe to measure the voltage on the pins ... if you measure some AC voltage you'll know that's your power. If you get continuity when checking for resistance, that's probably the earthing pin. The other one will probably be the temperature sensor.
If you look inside, you'll see two wires coming from a triac or something that controls the AC voltage going to the heater element, so you'll know those two wires are power. You'll see the temperature sensor wire going somewhere else near some opamp or comparator chip, so you'll figure it out quickly, and the earthing pin should be screwed to the case right there by connector, or should be a green wire going to a screw that holds the circuit board screwed in the unit.
Alternatively, you can figure out which wires are for the heater element by measuring the resistance across the wires ... most likely it's black and red for the heater element ... a 24v 50w-65w-ish heating element should have a resistance in the tens of ohms