...wut.
The rules are... (minus the 9001 exceptions that exist in the English language)
if the word starts with a consonant, use a.
if the world starts with a vowel, use an.
However hour is one of those oddballs where though it starts with a consonant, its pronunciation starts with a vowel...