There are whole books on this subject, so we cannot cover everything here. Basically, 'the' is used before a common noun which has been mentioned before in the conversation or is specific or is understood by the listener and speaker. 'A/an' is used for the first mention of a common noun or when referring to a non-specific representative of that noun.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.