I think that's a TRIAC, not a transistor. There's a G marking at one pin, no marking at other pins. I don't see a rectifier, I do see a 4A fuse and a 500W output, suggesting it's a 220V AC circuit. Probably a dimmer circuit similar to this one. The parts set is the same: two capacitors, inductor, DIAC (the blue part marked D, it looks like it has a double diode symbol under it), resistors. Probably a resistor that burned there.
Repairable? Maybe. Depends on what it was that caused that part to burn. That and the TRIAC need to be replaced at least. It is possible to make such a dimmer controlled by an Arduino or ESP8266 - you need to do zero crossing or peak detection on the AC line, and apply phase cutting. Not trivial, especially the hardware side due to the high voltages.
I think the green component next to the coil is the diac (based on the marking D and the partly obscured printing under it), don't know why there would be two of those.
Looks like a conventional lamp dimmer circuit. If the triac failed in such away as to connect mains across the diac, burning out it's lead in the process, it's no wonder it blew that up too.
Don't bother to repair it - a domestic lamp dimmer is cheap.