Yes, we know the rainbow is caused by the sun reflecting off the moisture in the
air and giving this optical effect in the sky. But as in all things..... why? After
God destroyed the earth in the Great Flood (story of Noah), the book of Genesis explains
the real reason for the rainbow. And God said:

“This is the sign of the covenant I make between Me and You, and every living
creature that is with you, for perpetual generations: I set My Rainbow in the cloud,
and it shall be for the sign of the covenant between Me and the earth. It shall be
when I bring a cloud over the earth, that the rainbow shall be in the cloud; and
I will remember the covenant which is between Me and you and every living creature
of all flesh; the waters shall never again become a flood to destroy all flesh".
GEN. 9: 12-15.