The indefinite articles "a" and "an" are used for singular countable nouns—like "a tree" or "an apple." While we say "the sun" because there is only one, we use indefinite articles when talking about something that is neither specific nor unique, and particularly when we mention it for the first time.
Look, if you want, we can go and get a tree this weekend.
Caption 38, Falling For Christmas: Full Movie
Play Caption
And I pre-slice an apple by my bed.
Caption 102, Food Diaries: Everything Kylie Jenner Eats in a Day
Play Caption
The simple explanation is that "a" is used for nouns that begin with a consonant and "an" is for those that begin with a vowel. But this actually relates to the sound the word begins with, not the word's spelling! In the words "hour" and "honor," the "h" is silent, whereas "university" begins with a "y" sound. This is what determines the appropriate article.
You could just drop by the shop in about an hour.
Caption 54, Falling For Christmas: Full Movie
Play Caption
Well, it's such an honor to be here. I'm so honored.
Caption 14, The White House: Jimmy Fallon at the White House
Play Caption
Technically, a university is generally a school that offers an undergraduate and a graduate program.
Captions 38-39, Ask An American: COLLEGE, UNIVERSITY, and HIGH SCHOOL in the U.S.
Play Caption
It's important to note that if there is an adjective before a noun, this is what determines whether "a" or "an" is used. You can see below that even though "idea," "ability," and "honor" all start with a vowel sound, the preceding adjective begins with a consonant sound, which requires "a." The opposite is the case in "an interesting history."
Jim, if you ask me, and you haven't, I think this is a terrible idea.
Caption 34, DeForest Kelley: Dr McCoy Star Trek
Play Caption
English has shown a unique ability to absorb, evolve, invade, and, if we're honest, steal.
Captions 4-5, The History of English Global English
Play Caption
Uh, so, Mr. President, it was a great honor being with you.
Caption 44, Global News: Barack Obama and Donald Trump meet at White House
Play Caption
This is Tranquille River, and it has an interesting history.
Captions 38-39, Merve: Outdoor in Canada
Play Caption
Further Learning
You'll find many, many examples of "a" and "an" used on Yabla English.