Aperture priority is just a variant of auto-exposure mode where you set the aperture and the camera set the shutter speed (based on auto-exposure).
But this doesn't work well for subjects like the moon. While the moon is comparatively bright compared to the background... the background is basically black.
Auto-exposure has a hard time believing that all these metered points used to determine the exposure are actually "black" ... it wants the camera to expose closer to a middle gray. In an effort to bring up the background, it massively over-exposes the moon and takes an exposure much too long.
Lunar Exposures
The moon is essentially lit by the Sun. Based on this, you'd think you could just use the manual exposure for subjects lit by the mid-day Sun ... the "Sunny 16" rule. This rule says that on a clear (Sunny) day at f/16 (and only at f/16) the correct exposure duration is the inverse of the ISO. E.g. at ISO 100, use 1/100th sec. At ISO 400, use 1/400th sec. etc. You can use other f-stops provided you compensate for them (e.g. open up by a stop then halve the exposure duration).
But this doesn't quite work as neatly with the Moon.
Atmospheric Extinction
The Sunny-16 rule doesn't work as well at Sunrise or Sunset when the Sun appears to be significantly less bright than it does at mid-day. This is because the Sun must penetrate significantly more atmosphere to reach your location than it would at mid-day. If you think of mid-day as the Sunlight needing to penetrate one "thickness" of atmosphere... at Sunrise or Sunset it maybe need to penetrate more like five times as much. That also means there is five times as many particles such as dust, smog, or other particles in the air to absorb or scatter the light.
This concept of the atmosphere blocking some of the inbound light is called "atmospheric extinction".
Looney Eleven
The lunar exposure rule attempts to compensate for the Sunny-16 rule by recognizing that after the Sun illuminates the moon, the moonlight traveling toward your camera still has to pass through at least one atmosphere worth of particles that can block (extinguish) the light.
This rule suggests that when the Moon is high in the sky, the correct exposure for the Moon is found by using f/11 (instead of f/16) and setting the shutter speed to the inverse of the ISO. In other words it's the same idea as the Sunny-16 rule except it opens up by one full stop (from f/16 for the Sun ... to f/11 for the Moon) to compensate for atmospheric extinction.
Like the Sun... if you are shooting the Moon near Moonrise or Moonset ... the light must travel through significantly more mass and that means it will appear even dimmer... you would need to open up the aperture to compensate (or increase the exposure duration).
One other little side-note... the reason the Sun or Moon both appear to be more "red" (orange) near rise or set times rather than the same hue but merely more dimmed ... is because not all colors are blocked equally. Blue wavelengths of light (shorter wavelengths nearer to 400nm) are so short that they are completely blocked and scattered. But red wavelengths (nearer to 700nm) are longer and they are larger than many of the particles in the air. As such they can pass through more dust (this is the same reason that astronomers use infrared wavelength telescopes and camera to be able to look "through" dust clouds in space. Dust is semi-transparent to these longer wavelengths.
As such, Sun and Moon will appear more "orange" near rise/set times because a little green and even more blue wavelengths are blocked as compared to red wavelengths.