Zircon, when it is forming, readily incorporates uranium into its crystal lattice. On the other hand, it strongly rejects lead. You would not expect to find any lead in a freshly grown zircon crystal due to this exclusion.
Once the crystal is formed, however, any uranium that is already in the crystal structure can naturally decay into the lead through radioactive decay, and once there it is stuck in place.
Since we have a good understanding of the decay rates of uranium isotopes, it then becomes a relatively simple matter of determining the ratio of uranium (that has not yet decayed) to lead (which formed through the decay of uranium), and we can then calculate how long ago that particular crystal of zircon formed.
This allows us to determine the age at which very old rocks were originally formed. By deduction, the oldest rocks we can find on the planet are going to have formed around the same time as the Earth, and there we come up with an age for our planet.