An Arduino pin can source about 20 milliamperes — enough to light an LED, not enough to do anything else interesting. Most loads in the real world (a fan, a heater, a solenoid) need 50× to 5000× that current. The relay is the cheapest, simplest way to bridge the gap.
What a relay actually is
A relay is a coil and a mechanical contact. Run current through the coil and it becomes an electromagnet, pulling the contact closed. The contact then carries a much larger current through a completely separate circuit. The chip controls 20 mA; the relay switches 10 A. Galvanic isolation comes free: there's no electrical connection between control and load.
Three things the relay needs you to know
You need a transistor between the pin and the coil. The coil draws 50–100 mA, more than a pin can handle. A small NPN BJT with a base resistor (or a MOSFET) does the job. Cheap relay modules include the transistor on board so you just connect a pin and 5 V.
You need a flyback diode. When you turn the coil off, the collapsing magnetic field induces a high-voltage spike — easily 100+ volts on a 5 V coil. A diode in parallel with the coil (cathode to 5 V, anode to coil low side) shorts that spike harmlessly. Without it, your transistor doesn't survive long. Most relay modules include the diode too.
Mains voltage is not a toy. If you're switching 240 V appliances, the relay's contacts may be carrying current that can kill you. The relay itself is rated for this, but your hands and your code aren't. Test with low voltage first.