Why is it "an yearly"?
Solution 1:
At first I thought OP had just found a bad transcription. The copy I just picked up from Pennsylvania State University says a yearly, as you would expect (ditto gutenberg.org).
Thanks to @D Krueger for ferreting out Google Books scanned copy of the 1778 edition, which has an yearly.
A few centuries before Adam Smith, the indefinite article was always an. As Wikipedia says, 'an' and 'a' are modern forms of the Old English 'an', which in Anglian dialects was the number 'one'.
I can't say for sure if Adam Smith himself actually wrote an, or if it was a well-intentioned typesetter preparing the text of those early editions. At that time I suspect neither version would have been universally recognised as "correct", though there's no doubt a was far more common even then. Here's an NGram for an yearly showing a marked increase in frequency of occurrence starting around the time Smith's book was published, and petering out over the next few decades.
I think an yearly [income, etc.] would be likely to occur more often in legal texts, which are always more prone to archaicisms even today. It's possible Smith or someone else involved in the printing process thought that using an archaic/legalese form added a touch of gravitas to the work.
Solution 2:
This is highly speculative, but Google Ngrams shows that people were confused as to whether to say "a uniform" or "an uniform" through most of the 18th Century. This is because the Great Vowel Shift changed the pronunciation of "uniform" so that instead of starting with a vowel, it started with a "y" sound.
My speculation is that people kept on saying "an uniform" even after "uniform" was pronounced with a "y" sound, and that this confused them as to whether "an" or "a" should be used before words that began with a "y" sound. The only evidence I have in favor of this is that the dates roughly match.
Robert Nares in his 1792 guide to English pronunciation, says that "long u" starts with the "y" sound; Google Ngrams shows that most people were still writing "an uniform" at this time (I don't know what they were saying).
Solution 3:
This may be owing to the notion that 'y' is a vowel, and therefore deserves to have 'an' preceding it.
This phrase has nearly 300,000 hits on Google, many of which are modern in origin and used with a straight face. I would say these are mostly based on the 'y as vowel' misconception. Google's Ngram viewer shows some usage of 'an yearly' in the early 19th century which then peters out: