The 8051 uses the crystal for precisely that: to synchronize it’s operation. Effectively, the 8051 operates using what are called "machine cycles." A single machine cycle is the minimum amount of time in which a single 8051 instruction can be executed. although many instructions take multiple cycles.
8051 has an on-chip oscillator. It needs an external crystal thats decides the operating frequency of the 8051.
This can be achieved in two ways.
The crystal is connected to pins 18 and 19 with stabilizing capacitors. 12 MHz (11.059MHz) crystal is often used and the capacitance ranges from 20pF to 40pF.
The oscillator can also be a TTL clock source connected with a NOT gate as shown