Once Brahma ji and Vishnu ji started fighting with each other to show their supremacy. At that time Lord Shiva appeared and installed an endless pillar between them at which point both Brahma ji and Vishnu ji stopped fighting and started looking for the end of the pillar. Then Lord Shiva appeared and told them about their designations that they are not supreme. Then Shiv ji gave a description about the Panchakshri mantra. See the video below from Shiv Purana to read the full account.