A and an signal that the noun is indefinite, referring to any member of a group. These indefinite articles are used with singular nouns when the noun is general; the corresponding indefinite quantity word some is used for plural general nouns.
a boy
an elephant
a broken egg
a girl
some girls
0 Girls (no article)
The rule is:
If the noun follows another word, like an adjective, the choice between a and an depends on the first sound of the that word;
Note also that in English, the indefinite articles are used to indicate membership in a profession, nation, or religion.