The temple coin is an old coin that is obtained from Olbertus in the Forthos Dungeon, either by trading him five unnoted cut 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 200 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.
However, if players simply choose to hand him the five unnoted cut dragonstones, then only 100 eligible types of dragon bones will be needed, therefore this second option is more recommended over 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