If there is no gravity on the moon, how could this flag be flapping in the wind? (source)
Ignoring the "no gravity" part of your question - there is, it's 1/6th that of the Earth - and assuming that you mean "no atmosphere", the flag looks like it's "waving" because the horizontal rod that runs along the top of the flag got stuck part way out. This meant that the flag didn't "unfurl" fully and is hanging like a curtain rather than being stretched flat as was the original intention. The rod was used because NASA knew that, with no atmosphere and hence no wind, a flag would just hang limply down and look, quite frankly, pathetic. (I assume that they thought of using a panel but rejected it because of the space it would take up).
The pole was also rotated several times during the planting process before Armstrong and Aldrin took the photo so any movement is due to simple inertia - (Source). The lack of atmosphere on the moon means that there's no air resistance to slow down the flapping so it will last a lot longer than on Earth (assuming still air).
This happened on Apollo 11 and they liked the effect so much they replicated it on subsequent missions.
First of all, there is gravity on the moon; it's just weaker than the gravity on Earth.
Second, gravity has essentially nothing to do with whether a flag flaps. If you managed to create windy conditions in a zero-gravity environment, any flags placed in that wind would flap just as well as they do on Earth (or perhaps even better, since gravity wouldn't be pulling them down when the wind dies down). The reason a flag streams out behind its flagpole is just that the flag reacts to the wind, whereas the flagpole doesn't - it's closely related to the reason that an arrow or a rocket maintains its orientation during flight (the fins react to the wind more than the body or nose). And although I'm not an expert on fluid dynamics, as far as I know the actual flapping has to do with turbulence induced in the wind by the flagpole and the flag itself. None of these behaviors require gravity.
In any case, it's not even clear that the flag is flapping in that photo, because there's a rod along the top holding the flag up. But as I said in my comment, that sort of discussion is better handled on Skeptics.
There is gravity on the moon. The gravity on the moon is about 1/6 the amount we have on Earth, but it is there. Anything with mass, anything has a gravitational field. For something like a baseball, this field is minute enough that you will never notice it. For something like the moon with a mass of 7.3459×10^22 kg (From Wolfram Alpha) the gravitational field is quite noticeable.
There are several reason that a flag could be waving on the moon.
- The flag has likely not fully unfurled. This would cause the wrinkles seen in this picture.
- Inertia. The astronauts seen in the photo had to rotate the flag in order to set it up.
I should point out that the only noticeable "wind" in that area came from the LEM's rockets as they left the moon. However, since that photo had been taken before they left, and that there is a almost non-existent atmosphere on the moon, wind had no part in making that flag "wave".