There are some sayings which were designed to be said with a tongue firmly planted in the speaker's cheek, and the supposed connection between the Moon and green cheese is one of them. When people say the moon is made of cheese, they are almost invariably being sarcastic or deliberately obtuse. Since the real (and cheese-free) composition of the Moon should be a well-established bit of knowledge, anyone who would honestly believe it was made from green cheese would clearly be seen as ignorant or gullible. This is the context under which most people bring up the connection in conversation.
The reference to green cheese comes from an alternative meaning for "green." The cheese is not green in color, but green in the sense of "unripe" or "young." A young cheese would not have time to develop all of the flavors and other nuances of a fully-ripened cheese, although it would share the same round shape and mottled texture. Some linguists speculate that the reference served to reinforce the idea of gullibility or naivete surrounding a belief in the Moon's dairy origins.
This is not to say that a green cheese comparison would be completely illogical, however. The Moon does have a round shape, and even without magnification it does appear mottled and pocked, much like a disk of cheese. The saying "the Moon is made from green cheese" is meant to imply a baseless belief which could be easily disproved, although the imagery still works on a symbolic or metaphorical level.
Some astronomers and researchers have periodically issued satirical reports which attempt to prove the Moon is actually made of cheese. Authentic satellite photographs of the Moon's surface are often doctored to reveal an "expiration date" typically found on packaged cheeses. Other "evidence" of the Moon's cheesy origins could include the presence of so-called "lunar mice" or green-tinted photographs of Swiss cheese-like craters. If nothing else, these satirical reports on lunar cheese do prove that astronomers and other experts on space are sadly underused sources of high-tech humor.