The story of the Shivling worshipped in the Rameshwaram Temple is associated with Ramayana. Sri Ramalingeswara is the seventh Jyotirlinga among the 12 Jyotirlinga worshipped in India. In the Ramayana, Lord Rama went to Madhava Mountain after the death of Ravana.
He asked the saints residing on the mountain about the result of killing Ravana as he is a Brahmin. Ravana was a Brahmin. He thought that the sin is equal to the murder of Lord Brahma. He asked them the way to wash off the sin. They told Lord Rama to install Shivalinga and worship it. Thereby the sin would be cleared out.
To fulfill the deed, Lord Rama ordered his devotee Lord Hanuman to bring Shivalinga from Kailas. Lord Hanuman did not turn up in time. Lord Rama along with Sita installed Shivalinga made of sand.
Next moment, Lord Hanuman came with Shivalinga and found what had happened. Lord Hanuman felt very unhappy.
To make Lord Hanuman happy, Lord Rama ordered him to pull out the linga and install his linga brought from Kailash. Lord Hanuman tried his best to pull out the linga but in vain. Immediately Lord Rama told His devotee that he would install his linga beside the previous linga. The ‘linga’ installed by Lord Rama is called 'Ramalingeswara' and the ‘linga’ brought by Lord Hanuman is called 'Hanumadeswaralinga'.