A typical 5 V relay coil is about 70 Ω, so it draws:
I_coil = 5 V ÷ 70 Ω ≈ 71 mA
To switch it fully on, give the transistor a base current of about a tenth of that, around 7 mA:
RB = (3.3 V − 0.7 V) ÷ 7.1 mA ≈ 364 Ω → use 330 Ω (7.9 mA)
That is within what a 3.3 V microcontroller pin can supply. Check your relay's coil resistance on its datasheet or with a multimeter and redo the sum if it differs.
The diode matters. When the transistor turns off, the coil's magnetic field collapses and drives the collector voltage far above 5 V. The 1N4007, fitted with its cathode (stripe) to +5V, gives that current a safe path. Without it the transistor eventually fails.
The contacts (COM, NO, NC) are a separate, isolated switch: wire your load through COM and NO for "on when energised".