You use 'a' before nouns that begin with a consonant sound. These include all of the 21 consonants, b, c, d, f and so on, and also the vowel 'u' when it is pronounced as 'yu'. For example:
You use 'an' before nouns that begin with a vowel sound. These include the five vowels - a e i o u (except when 'u' is pronounced 'yu' - see above) - and
h when it is silent.