The story of the dispute goes like this:
Dispute of Brahma and Vishnu
In the days of antiquity a controversy arose between Brahma and Vishnu as to which of the two was greater. Brahma said to Vishnu, "I have created the five elements and all the living beings with their endless differences in form and sound. Therefore I am the Absolute God." Vishnu said, "The whole universe is but an aspect of mine. Of what use is your creation if I do not protect it? It is my thought-power that creates, sustains and destroys the whole Universe. So I am the Absolute God" Their dispute resulted in misery in the manifested world. Supreme Being Parameshwara saw this and was filled with compassion. To settle the discord and subdue their pride, Lord Shiva appeared before them in the form of blazing column of light and a voice issued from it asking them to seek its upper and lower limits and he who found either of these is the superior one. Both gods stopped fighting and decided to explore the ends. Brahma took the form of a swan and flew up to reach the top of the column of light, whereas Vishnu became a boar and started burrowing into the earth to find its base.
A thousand years passed as Vishnu dug deep into the nether worlds and the journey seemed endless. With all this power he could not discover the base and he got lost in meditation with the result that he experienced the Supreme Light which dwells in the hearts of all. He soon realised and recognised that his true strength was derived from this Supreme Light, that is Lord Shiva. He prayed to Shiva seeking His pardon and then returned to earth. Brahman who flew up as a swan was mounting the sky and the higher he soared, the column of light rose higher before him. He was growing despondent and was about to return when he saw a fragrant flower called Ketaki (screw-pine) falling towards the earth. On asking from where it had come, the flower revealed that it had come from the crest of the fire column that was none other than Shiva himself and that it had been descending for thousands of four-fold Yugas. Brahma requested the flower to say that both of them came down after seeing the crest and thus the flower swore to Vishnu in the presence of the Column of Effulgence that Brahma had reach the summit.
Splitting asunder the column of Light, Shiva appeared before the two Gods. When the lotus-eyed Vishnu saw him, he danced with joy. The guilty Brahma on seeing the Lord’s true form was confused and frightened. Mahadeva said, "The two of you need not be ashamed for having transcended your limits. Hari (Vishnu) pondered deeply and became enlightened. But Brahma has uttered falsehood and I now cut off his fifth head for that perjury. Brahma shall not hereafter be installed in any Temple. And this flower, which bore false witness, shall never again find a place on my head and shall not be used for my worship." After cursing Brahma and the screw-pine flower thus, Shiva turned to Vishnu and said, "Child! Be composed, I am pleased with you. You are one of my foremost devotees. You originated from me and are my sattwic part. At the end of the kalpa you shall merge in me."
Brahma and Vishnu prayed to Shiva to abide there forever as a Tejo Lingam. In answer to their heartfelt request, Parameshwara established himself as the Arunachala Hill and also as a small Siva Lingam at the eastern foot of the Hill for the welfare of the world and for those who desire to worship Him and obtain illumination.
[Abridged – The Glory of Arunachala]