Shouldn't it be an unit?
No, because it is pronounced "YU-nit." So, although it starts with a vowel, it sounds and is treated as if it starts with a consonant.