The temple coin is an old coin that is obtained from Olbertus in the Forthos Dungeon, either by trading him five dragonstones or by attempting to kill him. If players choose to kill him, he will transform into a level-186 Shaeded Beast, who will curse the Altar of the Sun and render it unusable until 100 eligible types of dragon bones are offered to the Sacred Bone Burner in the central chamber (see here), which removes the curse and reverts it into a normal altar that restores prayer points. Because of this, players are recommended give Olbertus the dragonstones instead of fighting him.
The coin is used on the Stone Relief in the Crypt of the Moon in order to unlock the chamber containing the Sacred Bone Burner and Eodan. The Crypt of the Moon is located in the long northern room full of Undead Druids, immediately east of the entrance. After entering the central chamber through the Stone Relief, the coin is consumed, and the chamber is permanently unlocked. Inside the chamber, there is a lever which unlocks the gate on the south wall of the room, allowing easy travel between the red dragons and the chamber.
It is lost upon death, however it can be retrieved from Olbertus without having to fight him again or pay five dragonstones.
For an exhaustive list of all known sources for this item, see here