There are two distinct classes of ancient thought on rainbows: supernatural and scientific. The scientific theories generally identify the rainbow as an optical phenomenon, based on the reflection of sunlight. The details vary between theories - for example, some writers thought that the light was reflected from clouds, and others that it was reflected from fine mist in the air, or raindrops (the correct explanation). The oldest surviving scientific discussion of the rainbow that I know of is by Aristotle, later writings in Europe and Western/Central Asia (and North Africa, if any) built on this beginning. Chinese writers were describing the rainbow as formed by the reflection of sunlight from raindrops by the 7th century.
"Reflection of sunlight" isn't a very detailed explanation. Detailed correct descriptions of how refraction and reflection produce the primary and secondary bows appear in Europe and Persia at the start of the 14th century (Theodoric of Freiberg and Kamal al-Farisi). A correct explanation of the colours and their origin had to wait until the relationship between white light and colour was understood - thus, the first "complete" explanation is Newton's. This still isn't really complete, since diffraction affects the width of each coloured band, and thus how much they overlap. For example, fogbows are largely white, since the colours almost completely overlap. The inclusion of diffraction in explanations had to wait until relatively recently, for modern wave theories of light (Young, Fresnel, etc.), and Airy provided a suitable approximate theory. Exact theory had to wait for the solution of the problem of the scattering of light by spheres, c. 1900 (Lorenz-Mie theory, with Lorenz publishing in 1890 and Mie in 1908).
Exactly how much of that you consider "ancient" depends on your definition of "ancient". Also keep in mind that not everybody knew the scientific explanations.
The other class of ancient writings and oral traditions on rainbows is supernatural explanations. The four main types of supernatural explanations are that (a) rainbows are messages from gods (e.g., see the flood story in Genesis), (b) gods or other supernatural beings (rainbow serpents in Australian cultures and elsewhere), (c) bridges or roads between the spirit world and the earthly world, and (d) divine artifacts (bows used to shoot arrows that make thunder, divine clothing, etc.).
Observations that humans can produce rainbows by making a spray of water drops (e.g., as noted by Seneca the Younger, c. AD65) can be strong arguments against supernatural explanations!