As you can see in the second image, the moon is a bright ball of light surrounded by a sea of darkness. Your camera's light meter will be fooled by this and see more of the darkness, resulting in an overexposed moon, like the moon in the first photo. Therefore, you either need to select the spot metering option, use a long telephoto to zoom right in close to the moon to get an accurate reading.
An easier way: The easiest way is to switch to full manual and take some test shots. My shot above was taken with a 400mm lens. It's important when capturing the moon like this that you use a shutter speed of at least 1/125. Because the moon is moving, a longer speed will result in motion blur. The exact settings will very much depend on how high it is in the sky. The higher it is, the brighter it is.
Set your camera to full manual and then set a benchmark of:
- Shutter speed: 1/125
- Aperture F5.6
- ISO 400
If overexposed, increase either the shutter speed, or reduce the aperture.
If underexposed, increase the ISO