It's the time since the rock itself fused from molten or other non-fixed form.
The age of formation of rock is typically determined unequivocably by radiometric dating. That "clock" uses the ratios of long-lived radioactive elements and their decay products (this is not radio carbon dating, which is similar but effective over a much shorter timespan of about 50,000 years).
The radiometric clock starts when the materials in the sample solidify and initial proportions of mother and daughter elements are fixed, "neither the parent nuclide nor the daughter product can enter or leave the material after its formation" (Wikipedia). That point in time is the "age" of the rock.
The specific decay chains used in geology are uranium–lead, samarium–neodymium, potassium–argon, rubidium–strontium, and uranium–thorium. These may rely on crystaline structures which cannot form when the daughter elements (decay products) are present, therefor the amount of daughter element present gives the age. (I know this is the case for some methods, I'm unsure it applies to all. The "this structure cannot form when the daughter products are present" feature is a compelling argument for age.)
https://en.wikipedia.org/wiki/Radiometric_dating
Newly-formed lava or other molten materials are "new" --- they've just been created as rock. The elements within them are older --- those date to whatever radiological apocalypse formed them (stellar fusion for elements up to iron, various novae and collisions between white dwarves and neutron stars for elements heavier than iron). And of course the protons and neutrons comprising them ... mostly ... date to the origin of the Universe in the Big Bang (there is some spontaneous creation of particles due to quantum energy and mass-energy fluctuations, though that's minimal).
The atomic transmutation of elements gives some interesting results. Virtually all of the helium in the Universe formed in stars from fusion of hydrogen. A very small percentage was formed in the Big Bang. But virtually all helium on Earth is the result of radioactive decay of heavy elements, forming beta particles (two protons and two neutrons), that is, a helium nucleus. When that picks up electrons, it becomes helium. It's generally trapped with natural gas and produced as a by-product of gas wells.