Some background:
We are able to determine the age of certain rocks and minerals using measurements of radioactive and radiogenic isotopes of certain elements. The most common are U-Th-Pb, Rb-Sr and Sm-Nd. Simply put, the resulting date is the time that has passed from the crystallisation of that mineral. Obviously there are complexities, but there are not critical for this answer.
Why do we use meteorites if they hit the Earth after its formation?
Short answer: because the meteorites formed together with the Earth and the rest of the Solar System.
Long answer: The Earth formed together with the rest of the Solar System and its meteorites around 4.5 billion years ago. When meteorites fall on Earth and you pick them up, you are able to date the time of their formation.
You say:
Why do we use meteorites if they hit the Earth after its formation?
You have to distinguish the time that the meteorites form and the time that they hit the Earth. If I throw a meteorite at you, and you date it, it still records the formation time and not the time that I threw it at you. Hitting the Earth does not reset the radioactive clock in the meteorite's minerals.
Wouldn't it be more accurate by doing it with its inner materials?
It would. There are two problems:
- We don't have materials from the time of Earth's formation. The Earth is a dynamic place, and rocks are getting formed and destroyed all the time (also see related question). It may be that such old rocks exist on Earth, but because they are so old there are either metamorphosed and buried deep in the Earth or covered by sedimentary rocks. The oldest exposed rock on Earth available for study is the 4 billion year Acasta Gneiss in Canada. The oldest mineral on Earth is a zircon found in Australia, which is 4.4 billion years old. These are the only two materials that are known to be older than 4 billion years on Earth. There could be more, but we just couldn't find them.
- The moon forming event occurred some tens of million of years after the formation of the Earth. This event destroyed the Earth's crust and any evidence of the age of the Earth, on Earth itself.
This is why meteorites are excellent for this task - they mostly formed during the formation of the Solar System.