Using my Nikon D3200, I tried to capture an photo of the moon using the 18-55mm kit lens. I can see a faint blueish circle, even in my view finder, and also in the final picture. Is this lens flare or something else? How do I avoid it?
I agree with what Hermann said, but have a different answer as to how to avoid this.
Expose properly. Notice that the blue smudge is much dimmer than the moon, which is so bright that it is totally blown out and even has a quite visible halo around it. Some of that may be caused by atmospheric effects, but I also suspect blooming due to extreme over exposure.
You don't say what exposure you used, but it looks like you just pointed the camera at the moon and clicked. The moon is actually quite bright, but a very small part of the frame. Most of the frame is very dark, basically black when compared to the moon. This fools the automatic exposure selection in your camera. You need to manually set the exposure for this type of scene.
I did some tests to find a good exposure for the full moon. My answer was ISO 200, 1/125 s, f/8.0. Compare that to what you used.
All light coming in thru the lens will bounce around and a fraction of it will show up in other parts of the picture. The reason this is not usually a issue is because these ghost images are much dimmer than the original. For normal scenes with the brightest parts just at the top of the sensor range, the ghosts are dim enough to be in the noise. In your case, the original was so overly bright that the much-attenuated ghost image was bright enough to show up, especially since it fell onto a area of the picture that was very dark.
With the moon properly exposed, the ghost image will be so dim that you probably won't be able to see it.
This is lens flare in the best case and a mirrored ghost image caused by the UV filter in the worst case.
Or the other way around because you could fix the one of them by removing the filter. But obtaining a better lens is more expensive. :-)
Ghosts caused by filters are typically exactly opposed of the light source that is mirrored. In the event that you have more than one (there is just one moon though) and draw a line from the light to its ghost then all these lines will cross exactly in the middle of the image. (original image - not croppted at all)
It is a type of lens flare known as ghosting that is caused by reflections from inside the lens or possibly the front of the sensor bouncing off the back of an optical element further forward. The color difference is two-fold: the influence of the anti-reflective coatings on most lens elements and the difference in brightness between the primary source of light (in this case the moon) and the reflection.
When an object is reflecting blue light at twice the intensity of red and green light but all three channels are bright enough to reach the sensor's saturation point the light will appear white in the photograph. Thus if the color balance/white balance is adjusted heavily towards blue the moon will still appear white because it is so heavily overexposed. But the intensity of the reflection is much less and the greater amount of blue compared to red and green will be seen.
As others have said, ghosting and other types of flare are present in almost any shot that includes very bright light sources, but it is usually masked by other bright areas in the frame. When most of the frame is dark, though, the dimmer reflections are more noticeable.
See this answer for examples of flare that is more noticeable as the exposure value is increased when taking photos of the same subjects with the same camera/lens combination.
It could also be sensor dust, I got mine cleaned to avoid such spots in long exposure, high aperture shots.