I read a quote attributed to Pope Innocent III that says, that the relationships between the emperor and the pope are like the relationships between the sun and the moon, one gives shine to the other. If said quote is true, then when did it became known that sun gives shine to the moon?
The first two people in Europe reported to espouse this belief are Thales of Miletus^1 (born about 620 BCE) and Anaxagoras (born about 500 BCE). Thales of Miletus found the shapes of celestial bodies via eclipses. He argued that if the earth were not a sphere, a lunar eclipse would not have a disc shaped shadow, so he knew the role of shadows at least in the lunar eclipse and that the moon clearly did not produce its own light. Anaxagoras outright stated the Moon does not generate light but rather reflects it.^2
While there were competing theories among the Ancient Greeks, the later Europeans followed Aristotle who agreed with them about this (via Ptolemy during the period until the 13th century where Aristotle's astronomical text was temporarily only in Arabic, although occasional Europeans did read Arabic Aristotle translations). In the time of Pope Innocent III it would have been known to educated persons (but not necessarily laypeople, unlike the shape of the earth).
As you didn't restrict the location, I happen to also know a little about Chinese astronomy and will share. Jīng Fáng (born 78 BCE) wrote that the moon and planets only have light when the sun illuminates them, but it is clear that this is well-known to scholars at that time^3. The only significant person I know of by that period to disagree was the notable gadfly Wáng Chōng. He disagreed for philosophical objections to heavenly bodies being passive (recipients of light) rather than active (generators of light). This isn't particularly surprising: he seems to have made it his mission to disagree with everything the mainstream said, albeit usually more successfully than this.
China seems to have lagged Greece somewhat in this respect. The earliest relevant Chinese astronomer I can find is Shí Shēn (4th century BCE) who noted that solar eclipses only happen when the moon and sun are exactly aligned with the Earth. This doesn't necessarily indicate a knowledge of why, however, so it's not certain he would have known about shadows and the moon's lack of generated light. There is even some evidence against it, as Shí Shēn thought sunspots were a third type of eclipse which possibly indicates he hadn't grasped the implications of the positioning he explained.
In general, you have to be cautious about saying when "people" figured it out. While some Chinese astronomers may have known it in this year or that year, it took hundreds of years for this knowledge to diffuse out universally. As an example, even in Wang Chong's time he mentioned that some otherwise educated people thought eclipses somehow involved the other planets as well as the sun, moon and earth. This despite it having been mathematically obvious (to the degree of predicting eclipses with it) and recorded in standard texts for many years.
1: Internet Encyclopedia of Philosophy, "Thales of Miletus"
2: Early Greek Philosophy (John Burnet)
3: Science and Civilisation in China: Volume 3 (Joseph Needham)