Both of them are articles with different usages.
“a” is used when there is only one thing, and it is applicable to noun beginning with a consonant sound.
“the” is used in front of a noun when we are trying to be specific.
“a” and “the” both are articles and determiners which mark the referential intent of noun phrases. They are used to signify levels of definiteness or knowingness.
The use of “a”, it is indefinite, can be used before proper nouns, as an instance “a school”, this can be referring to any school the listener knows, there is no definite school mentioned.
While for “the”, it is definite, same as “a”, it can be use before any nouns, the difference is that the noun mentioned is identifiable for the listener, another example “the school”, the listener knows which school the speaker is mentioning,
When something becomes known information to you, it is referred to as a specific thing. When referring to specific things, the definite article, "the," is used. For example, "a naughty cat" in the yard becomes "the naughty cat " after you know it.