transistors heat up

Hello.Hello. I am using bdx53c transistors for 12v 40 watt lamp to controlling with arduino.I control the light with potentiometer but transistor is heating up.I am using the cooler. What would your suggest for this problem.

Ben de bu örnek kaynak adresi aldım:

but transistor is heating up.

Yes it will.
It will be dissipating just over 6.6 Watts, so it will get hot.

What would your suggest for this problem.

Change the laws of physics?

Failing that use a heat sink or use a logic level FET in place of the transistor.

Find a N-channel MOSFET with Logic Level Gate (switches full on from 4.5V or less), Low Rds (like .012 ohm, 12 mOhm or less), through hole part, such as

Your lamp uses a lot of current:
P=I x V, or P/W = I. 40W/12V = 3.33A

Transistor will dissipate power too, P=I x V, and V=I x R, so P=I x (I x R), or P = I^2 x R:
P = 3.33Z x 3.33A x .012ohm = 133mW, nice & cool. Maybe a small heat sink needed.

MOSFETs are way better than BJTs (NPN, PNP) for switching power on/off due to their lower on resistance, vs fixed Vce drop of NPN.

Basically noone uses darlingtons any more for this purpose, MOSFETs are always
superior. The reason you can still buy them is for legacy products and spares mainly.

Darlingtons always waste between 1 and 2V, so the power wasted is large, heatsinking
is needed and they are also slow to switch off so not usually suitable for fast PWM.
MOSFETs are available with on-resistances down to 0.001 ohm or so and switch fast.
Often you can get away with no heatsink, making designs smaller, simpler, cheaper.

For driving direct from 5V a logic-level n-channel MOSFET is the one to go for. Pick
one with low on-resistance and a sensible voltage rating (30V is plenty - higher
voltage rating means more on-resistance, all else being equal).