atmega328 pin20

I know Vcc is the voltage. Aref is the analog reference voltage. What is AVcc on pin 20? Is it necessary?

Analog Vcc.

Its absolutely essential and it must always be within 0.5V of Vcc.

Its provided as a separate pin so you can filter out digital noise from the
ADC and analog comparator circuitry on the chip. It would normally be
connected to Vcc via a resistor, RFC or ferrite bead and separately decoupled.

Though not stated anywhere I assume the neighbouring ground pin is the
analog ground pin in effect. The 328 doesn't recommend separate digital and
analog grounds though.

Its also not pin 20, its pin "AVcc". Different packages have it numbered
differently (for instance its pin 18 on the TQFP32 version of the chip.

From the ATmega328 datasheet.

Section 1.1.7

AVCC is the supply voltage pin for the A/D Converter, PC3:0, and ADC7:6. It should be externally connected to VCC, even if the ADC is not used. If the ADC is used, it should be connected to VCC through a low-pass filter. Note that PC6...4 use digital supply voltage, VCC.

Section 24.2

The ADC has a separate analog supply voltage pin, AVCC. AVCC must not differ more than ±0.3V from VCC. See the paragraph ”ADC Noise Canceler” on page 248 on how to connect this pin.

How come the ADC works if I don't connect it?

You have internal leakage current thru input clamp protection diodes. Too much current, and the diodes blow.
Connect AVcc to +5, and add a 0.1uF cap from the pin to Gnd.