Grahpati Shiva is one of the manifestations of Shiva. The story of Shiva as Grihapati is mentioned in the Shaivagama. Grahpati means the lord of the planets.
Legend has it that once the wife of Sage Vishwanar had a desire to have a son. To fulfill the desire, Sage Vishvanar went to Kashi and offered prayers to Veereshwar Linga there.
After a year, Shiva appeared as a boy before Sage Vishwanar and granted him the boon that He will be born as their son. Shiva said that he will be known as Grahpati.
As per the boon, Suchimati, wife of Sage Vishwanar, gave birth to Grihpati. The sage performed all the sanskaras of the boy.
When the boy was nine year old, Sage Naraga visited Sage Vishwanar and told him that the boy will be struck by lightning during the 12 year of his life.
Sage Vishwanar was saddened by this fact. But Grihapati said that he will go to Kashi and offer prayers to Shiva and will overcome death.
Grihapati went to Kashi and made Shivling and started offering worship to it.
When it was the 12th year, Indra appeared before the boy and offered a boon. But the boy was not ready to take any boon from Indra and said that he will take boon from Shiva only.
Hearing the words of the boy Indra became angry and decided to punish the boy. He threatened to kill the boy with lightning. But Shiva appeared and told the boy that not even Yama can harm his devotee.
Shiva gave him the boon that Agni will not touch him.
The Shivling that was used by Grihapati to worship Shiva became known as Agnishwara.
The Shivling is still worshiped in