Here is the story from the Vissudhimagga, starting at XI. 105, which starts as a question, so you might want to read the previous sections from the PDF here: http://www.accesstoinsight.org/lib/auth ... index.html
105. Here the Elder Tipiþaka Cú¿a-Nága said: “But, friends, why does what is
clung to not become small and big too? When a bhikkhu comes out through a
keyhole, does not what is clung to become small? And when he makes his body
big, does it not then become big, as in the case of the Elder Mahá Moggallána?”
106. At one time, it seems, when the householder Anáthapióðika had heard
the Blessed One preaching the Dhamma, he invited him thus, Venerable sir, take
alms at our house together with five hundred bhikkhus,” and then he departed.
The Blessed One consented. When the rest of that day and part of the night had
passed, he surveyed the ten-thousandfold world element in the early morning.
Then the royal nága (serpent) called Nandopananda came within the range of
107. The Blessed One considered him thus: “This royal nága has come into
the range of my knowledge. Has he the potentiality for development?” Then he
saw that he had wrong view and no confidence in the Three Jewels.  He
considered thus, “Who is there that can cure him of his wrong view?” He saw
that the Elder Mahá Moggallána could. Then when the night had turned to
dawn, after he had seen to the needs of the body, he addressed the venerable
Ánanda: “Ánanda, tell five hundred bhikkhus that the Perfect One is going on
a visit to the gods.”
108. It was on that day that they had got a banqueting place ready for
Nandopananda. He was sitting on a divine couch with a divine white parasol
held aloft, surrounded by the three kinds of dancers and a retinue of nágas,
and surveying the various kinds of food and drink served up in divine vessels.
Then the Blessed One so acted that the royal nága saw him as he proceeded
directly above his canopy in the direction of the divine world of the Thirty-three,
accompanied by the five hundred bhikkhus.
109. Then this evil view arose in Nandopananda the royal nága: “There go
these bald-headed monks in and out of the realm of the Thirty-three directly over
my realm. I will not have them scattering the dirt off their feet on our heads.” He
got up, and he went to the foot of Sineru. Changing his form, he surrounded it
seven times with his coils. Then he spread his hood over the realm of the Thirty-
three and made everything there invisible.
110. The venerable Raþþhapála said to the Blessed One: “Venerable sir, standing
in this place formerly I used to see Sineru and the ramparts of Sineru, and the
Thirty-three, and the Vejayanta Palace, and the flag over the Vejayanta Palace.
Venerable sir, what is the cause, what is the reason, why I now see neither Sineru
nor ... the flag over the Vejayanta Palace?”—“This royal nága called
Nandopananda is angry with us, Raþþhapála. He has surrounded Sineru seven
times with his coils, and he stands there covering us with his raised hood,
making it dark.”—“I will tame him, venerable sir.” But the Blessed One would
not allow it. Then the venerable Bhaddiya and the venerable Ráhula and all the
bhikkhus in turn offered to do so, but the Blessed One would not allow it.
111. Last of all the venerable Mahá Moggallána said, “I will tame him, venerable
sir.” The Blessed One allowed it, saying, “Tame him, Moggallána.” The elder
abandoned that form and assumed the form of a huge royal nága, and he
surrounded Nandopananda fourteen times with his coils and raised his hood
above the other’s hood, and he squeezed him against Sineru. The royal nága
produced smoke. The elder said, “There is smoke not only in your body but
also in mine,” and he produced smoke. The royal nága’s smoke did not distress
the elder, but the elder’s smoke distressed the royal nága. Then the royal nága
produced flames. The elder said, “There is fire not only in your body but also in
mine,” and he produced flames. The royal nága’s fire did not distress the elder,
but the elder’s fire distressed the royal nága.
112. The royal nága thought, “He has squeezed me against Sineru, and he has
produced both smoke and flames.” Then he asked, “Sir, who are you?”—“I am
Moggallána, Nanda.”—“Venerable sir, resume your proper bhikkhu’s state.” The
elder abandoned that form, and he went into his right ear and came out from his left
ear; then he went into his left ear and came out from his right ear. Likewise he went
into his right nostril and came out from his left nostril; then he went into his left
nostril and came out from his right nostril. Then the royal nága opened his mouth.
The elder went inside it, and he walked up and down, east and west, inside his belly.
113. The Blessed One said, “Moggallána, Moggallána, beware; this is a
mighty nága.” The elder said, “Venerable sir, the four roads to power have been
developed by me, repeatedly practiced, made the vehicle, made the basis,
established, consolidated, and properly undertaken. I can tame not only
Nandopananda, venerable sir, but a hundred, a thousand, a hundred thousand
royal nágas like Nandopananda.”
114. The royal nága thought, “When he went in the first place I did not see
him. But now when he comes out I shall catch him between my fangs and chew
him up.” Then he said, “Venerable sir, come out. Do not keep troubling me by
walking up and down inside my belly.” The elder came out and stood outside.
The royal nága recognized him, and blew a blast from his nose. The elder attained
the fourth jhána, and the blast failed to move even a single hair on his body. The
other bhikkhus would, it seems, have been able to perform all the miracles up to
now, but at this point they could not have attained with so rapid a response,
which is why the Blessed One would not allow them to tame the royal nága.
115. The royal nága thought, “I have been unable to move even a single hair on
this monk’s body with the blast from my nose. He is a mighty monk.” The elder
abandoned that form, and having assumed the form of a supaóóa, he pursued the
royal nága demonstrating the supaóóa’s blast.  The royal nága abandoned
that form, and having assumed the form of a young brahman, he said, “Venerable
sir, I go for refuge to you,” and he paid homage at the elder’s feet. The elder said,
“The Master has come, Nanda; come, let us go to him.” So having tamed the royal
nága and deprived him of his poison, he went with him to the Blessed One’s presence.
116. The royal nága paid homage to the Blessed One and said, “Venerable sir,
I go for refuge to you.” The Blessed One said, “May you be happy, royal nága.”
Then he went, followed by the Community of Bhikkhus, to Anáthapióðika’s
house. Anáthapióðika said, “Venerable sir, why have you come so late?”—“There
was a battle between Moggallána and Nandopananda.”—“Who won, venerable
sir? Who was defeated?”—“Moggallána won; Nanda was defeated.”
Anáthapióðika said, “Venerable sir, let the Blessed One consent to my providing
meals for seven days in a single series, and to my honouring the elder for seven
days.” Then for seven days he accorded great honour to the five hundred
bhikkhus with the Enlightened One at their head.
117. So it was with reference to this enlarged form created during this taming
of Nandopananda that it was said: “When he makes his body big, does it not
then become big, as in the case of the Elder Mahá Moggallána?” (§105). Although
this was said, the bhikkhus observed, “He enlarges only what is not clung to
supported by what is clung to.” And only this is correct here.Footnotes
18. Vism-mhþ (p.394): “Vadhúkumárikaññá-vattháhi tividháhi náþakitthìhi.”
19. “‘The ramparts of Sineru’: the girdle of Sineru. There are, it seems, four ramparts
that encircle Sineru, measuring 5,000 leagues in breadth and width. They were built to
protect the realm of the Thirty-three against nágas, garudas, kumbhaóðas and yakkhas.
They enclose half of Sineru, it seems” (Vism-mhþ 394).
20. “Only this is correct because instances of clung-to (kammically acquired) materiality
do not arise owing to consciousness or to temperature. Or alternatively, ‘clung-to’ is
intended as all matter that is bound up with faculties (i.e. ‘sentient’), too. And so to
take it as enlargement of that is likewise not correct. Consequently, enlargement
should be understood only in the way stated. Though the clung-to and the unclung-to
occur, as it were, mixed up in a single continuity, they are nevertheless not mixed up in
meaning. Herein, just as when a pint measure (á¿haka) of milk is poured into a number
of pints of water, though the milk becomes completely mixed up with the water, and is
present appreciably in all, it is nevertheless not the milk that has increased there, but
only the water. And so too, although the clung-to and unclung-to occur mixed up
together, it is nevertheless not the clung-to that is enlarged. It should be taken that it
is the consciousness-born matter that is enlarged by the influence of the supernormal
power, and the temperature-born is enlarged pari passu” (Vism-mhþ 395).