Grammarly is useless.
The rule is that if the noun (or, as in this case an adjective that precedes a noun) starts with a vowel sound, always use 'an,' rather than 'a.' Quite clearly any adjective that begins with the prefix "un," begins with a vowel sound.