The Merriam-Webster dictionary says that "A1" means "of the finest quality" and it says that the term was first used in the year 1801 (with no reference): https://www.merriam-webster.com/dictionary/A1#h1
However it does not give any information about the origin of the word.
Wiktionary says the phrase comes from the classification of ships. A1 ships were the best, A2 and A3 were not as good. However they say the first use was in 1837 (again with no reference): https://en.wiktionary.org/wiki/A1
This page: https://www.thehindu.com/books/know-your-english/know-your-english-meaning-and-origin-of-a1/article6210180.ece, says that a ship is A1 if both the hull and the equipment are in excellent condition.
So by doing a lot of research, I have found out that the term "A1" comes from a ship classification dating back to ~200 years ago, but two dictionaries have given different dates for the etymology (1801 and 1837) and neither give any reference! Does anyone know a reference that would help me study better the origin of this term?