When did astronomy first discover that the stars are bigger than the
moon?
Your choice of words "discovery" implies evidence, not just hypothesis. The discovery that stars were like our sun wasn't possible until the distance to some nearby stars was measured and with that, a brightness comparison could be made between stars and our sun. That discovery was made in 1838.
The first person with that theory goes back to 450 BC. Short summary and longer summary.
Quote:
Anaxagoras, who lived in Athens, Greece, around 450 BC (about 2450
years ago), thought that the Sun and stars were fiery stones, that the
stars were too far away for their heat to be felt, and that the Sun
was perhaps more than a few hundred miles in size. With that
Anaxagoras was, as far as we know, the first one to suggest that the
Sun is a star. His ideas were met with disapproval and he was finally
imprisoned for impiety, because his ideas did not fit the prejudices
of the time.
So, while he suggested that stars were like our sun, his size was way off and it's unclear how large he thought the Moon was, or even, if he had a good idea how large the Earth was. Erastosthenes' estimate came later.
Aristarchus of Samos came up with a much better, but still quite inaccurate, measure of the Sun and Moon's size and he recognized that the Moon was smaller than the Earth and the Sun much larger. It's unclear what he thought about stars though.
And much more recently:
Christiaan Huygens of Holland lived from 1629 to 1695. He determined
the distance to the star Sirius, assuming that that star was as bright
as the Sun and appeared faint only because of its great distance. He
found that the distance to Sirius must be very great. At this time,
then, the idea that the Sun is a star was considered seriously by
scientists.
So the idea that stars were like our sun was popular and perhaps even accepted, for over 100 years before the size and brightness of stars was first accurately measured.
Did people believe that the moon was bigger than the stars for a long
time?
This is hard to say. Aristarchus of Samos ideas were less popular than Aristotle's (who came a little earlier) and Aristarchus' theories weren't central to Ptolomy's model which became the model for over 1000 years. I've often wondered what might have been different if Aristotle and Aristarchus could have exchanged ideas. Aristotle might have learned something and re-written his model, but Aristarchus was born too late.
Ptolomy, who's model was accepted by the Roman Catholic Church, didn't pay much attention to sizes and, in fact, his model doesn't account for size well at all. It's one of the ways that his model breaks down, but his basic model had the Moon closer to the Earth than the Sun, so presumably he recognized that the Sun was larger than the Moon and it's not unreasonable to guess that Ptolomy might have said the planets are smaller than the moon. The stars, however, were for the most part, not addressed.
If your question is, in particular, what Aristotle, Ptolemy up through scholars in the middle ages thought about the size of stars in comparison to the moon, then, I have to say that I don't know what was assumed about the size of the Moon and stars, though Giordano Bruno was burned at the stake for suggesting stars were like our sun. It's entirely possible most scholars thought stars were smaller than the Moon from the time periods between Aristotle to Kepler. If someone knows more specifics, I encourage them to answer.
Not long after Galileo and Kepler, it seems to have become more generally accepted that stars were large and very distant and the Moon was relatively small by comparison.