Indian mythology has it that, when only darkness existed all around, nether there was Earth or the Sun or the Moon. It was then that Lord Shiva's authority ruled. This was trillions of years ago.
Shiva had no beginning and he has no end.
Alternatively, Lord Shiva is the face of nature as envisaged in Hindu mythology.
As nature, Shiva is pictured as kind, ruthless, wild and in all forms that nature epitomes.
He was the creator. He was the destroyer. He was the giver and it was he who took away.
During the creation of the Universe, he was married to Parvati and they live in the Himalayas and have four children. Lakshmi the goddess of wealth. Swarasswati the goddess of knowledge, Kartikeya the defender of the earth and Ganesha.