A transistor is a switch the Arduino can flip.

Why is that useful?

Let’s say you want your Arduino to drive a heating pad, e.g. ioRef part #0434. You might think of wiring the heating pad to a digital output pin the same way you’d wire up an LED, like so:

Schematic of pin 6 driving a resisting heating pad; the other side of the heating pad is connected to ground. A dialog bubble coming off of pin 6 says "Ouch! Way too much current for me."

The problem here is that the big heating pad needs much more than 20mA of current to run, so you can’t drive it right off of a digital output pin.

Here’s an alternative approach: take the Arduino out of the equation totally and wire the heating pad to power and ground, with a switch on the ground side. If the switch is closed there’s a complete circuit and the heating pad gets warm; if the switch is open, power stops flowing and the pad cools down. Simple enough:

Schematic of a 5V power supply connected to a heating pad, to a switch, to ground.

A transistor is a switch that the Arduino can turn on and off. Let’s replace the switch with a transistor and we’re in business. We’ll use the IRLB8721PbF, ioRef part #8721.

Schematic of an Arduino's pin 6 driving an IRLB8721PbF transistor's gate through a 1kΩ resistor. The high side of the heating pad is wired to 5V, the low side to the transistor's drain, and the transistor's source is wired to ground.

Instead of supplying the power to run something directly off of a digital output pin, the Arduino turns the transisor switch on or off.

How do you actually wire up that IRLB8721PbF transistor? You need to know which of the pins is the gate, drain, and source because they’re not interchangeable, and they’re not labeled on the transistor itself. Here’s a “pinout” diagram showing which is which:

IRLB8721 pinout diagram; looking at the front of the device, from left to right the pins are gate, drain, source.