This essay presents the historical antecedents of Shiva and Vishnu and how they became popular gods in subsequently, although they were not prominently mentioned in the Vedic texts compared to gods such as Indra, Varuna and Soma. According to the author, their popularity might be due to influence of non-Vedic traditions which subsequently became a part of Vedic religion and later modern Hinduism.
Vishnu and Rudra are known even to the Rig Veda but as deities of no special eminence. It is only after the Vedic age that they became, each for his own worshippers, undisputed Lords of the Universe. A limiting date to the antiquity of Śivaism and Vishnuism, as their cults may be called, is furnished by Buddhist literature, at any rate for north-eastern India. The Pali Pitakas frequently introduce popular deities, but give no prominence to Vishnu and Śiva. They are apparently mentioned under the names of Venhu and Isâna, but are not differentiated from a host of spirits now forgotten. The Pitakas have no prejudices in the matter of deities and their object is to represent the most powerful of them as admitting their inferiority to the Buddha. If Śiva and Vishnu are not put forward in the same way as Brahmâ and Indra, the inference seems clear: it had not occurred to anyone that they were particularly important.
The suttas of the Dîgha Nikâya in which these lists of deities occur were perhaps composed before 300 B.C. About that date Megasthenes, the Greek envoy at Pataliputra, describes two Indian deities under the names of Dionysus and Herakles. They are generally identified with Krishna and Śiva. It might be difficult to deduce this identity from an analysis of each description and different authorities have identified both Śiva and Krishna with Dionysus, but the fact remains that a somewhat superficial foreign observer was impressed with the idea that the Hindus worshipped two great gods. He would hardly have derived this idea from the Vedic pantheon, and it is not clear to what gods he can refer if not to Śiva and Vishnu. It thus seems probable that these two cults took shape about the fourth century B.C. Their apparently sudden appearance is due to their popular character and to the absence of any record in art. The statuary and carving of the Asokan period and immediately succeeding centuries is exclusively Buddhist. No temples or images remain to illustrate the first growth of Hinduism (as the later form of Indian religion is commonly styled) out of the earlier Brahmanism. Literature (on which we are dependent for our information) takes little account of the early career of popular gods before they win the recognition of the priesthood and aristocracy, but when that recognition is once obtained they appear in all their majesty and without any hint that their honours are recent.
As already mentioned, we have evidence that in the fifth or sixth century before Christ the Vedic or Brahmanic religion was not the only form of worship and philosophy in India. There were popular deities and rites to which the Brahmans were not opposed and which they countenanced when it suited them. What takes place in India to-day took place then. When some aboriginal deity becomes important owing to the prosperity of the tribe or locality with which he is connected, he is recognized by the Brahmans and admitted to their pantheon, perhaps as the son or incarnation of some personage more generally accepted as divine. The prestige of the Brahmans is sufficient to make such recognition an honour, but it is also their interest and millennial habit to secure control of every important religious movement and to incorporate rather than suppress. And this incorporation is more than mere recognition: the parvenu god borrows something from the manners and attributes of the olympian society to which he is introduced. The greater he grows, the more considerable is the process of fusion and borrowing. Hindu philosophy ever seeks for the one amongst the many and popular thought, in a more confused way, pursues the same goal. It combines and identifies  its deities, feeling dimly that taken singly they are too partial to be truly divine, or it piles attributes upon them striving to make each an adequate divine whole.
Among the processes which have contributed to form Vishnu and Śiva we must reckon the invasions which entered India from the north-west. In Bactria and Sogdiana there met and were combined the art and religious ideas of Greece and Persia, and whatever elements were imported by the Yüeh-chih and other tribes who came from the Chinese frontier. The personalities of Vishnu and Śiva need not be ascribed to foreign influence. The ruder invaders took kindly to the worship of Śiva, but there is no proof that they introduced it. But Persian and Græco-Bactrian influence favoured the creation of more definite deities, more personal and more pictorial. The gods of the Vedic hymns are vague and indistinct: the Supreme Being of the Upanishads altogether impersonal, but Mithra and Apollo, though divine in their majesty, are human in their persons and in the appeal they make to humanity. The influence of these foreign conceptions and especially of their representation in art is best seen in Indian Buddhism. Hinduism has not so ancient an artistic record and therefore the Græco-Bactrian influence on it is less obvious, for the sculpture of the Gupta period does not seem due to this inspiration. Neither in outward form nor in character do Vishnu and Śiva show much more resemblance to Apollo and Mithra than to the Vedic gods. Their exuberant, fantastic shapes, their many heads and arms, are a symbol of their complex and multiple attributes. They are not restricted by the limits of personality but are great polymorphic forces, not to be indicated by the limits of one human shape. 
Though alike in their grandeur and multiplicity, Vishnu and Śiva are not otherwise similar. In their completely developed forms they represent two ways of looking at the world. The main ideas of the Vaishnavas are human and emotional. The deity saves and loves: he asks for a worship of love. He appears in human incarnations and is known as well or better by these incarnations than in his original form. But in Śivaism the main current of thought is scientific and philosophic rather than emotional. This statement may seem strange if one thinks of the wild rites and legends connected with Śiva and his spouse. Nevertheless the fundamental conception of Śivaism, the cosmic force which changes and in changing both destroys and reproduces, is strictly scientific and contrasts with the human, pathetic, loving sentiments of Vishnuism. And scandalous as the worship of the generative principle may become, the potency of this impulse in the world scheme cannot be denied. Agreeably to his character of a force rather than an emotion Śiva does not become incarnate as a popular hero and saviour like Râma or Krishna, but he assumes various supernatural forms for special purposes. Both worships, despite their differences, show characteristics which are common to most phases of Indian religion. Both seek for deliverance from transmigration and are penetrated with a sense of the sorrow inherent in human and animal life: both develop or adopt philosophical doctrines which rise high above the level usually attained by popular beliefs, and both  have erotic aspects in which they fall below the standard of morality usually professed by important sects whether in Asia or Europe.
The name Śiva is euphemistic. It means propitious and, like Eumenides, is used as a deprecating and complimentary title for the god of terrors. It is not his earliest designation and does not occur as a proper name in the Rig Veda where he is known as Rudra, a word of disputed derivation, but probably meaning the roarer. Comparatively few hymns are addressed to Rudra, but he is clearly distinguished from the other Vedic gods. Whereas they are cheerful and benevolent figures, he is maleficent and terrible: they are gods of the heaven but he is a god of the earth. He is the "man-slayer" and the sender of disease, but if he restrains these activities he can give safety and health. "Slay us not, for thou art gracious," and so the Destroyer comes to be the Gracious One. It has been suggested that the name Śiva is connected with the Tamil word çivappu red and also that Rudra means not the roarer but the red or shining one. These etymologies seem to me possible but not proved. But Rudra is different in character from the other gods of the Rig Veda. It would be rash to say that the Aryan invaders of India brought with them no god of this sort but it is probable that this element in their pantheon increased as they gradually united in blood and ideas with the Dravidian population. But we know nothing of the beliefs of the Dravidians at this remote period. We only know that in later ages emotional religion, finding expression as so-called devil-dancing in its lower and as mystical poetry in its higher phases, was prevalent among them.
The White Yajur Veda contains a celebrated prayer known as the Śatarudrîya addressed to Rudra or the Rudras, for the power invoked seems to be now many and now one. This deity, who is described by a long string of epithets, receives the name of Śankara (afterwards a well-known epithet of Śiva) and is blue-necked. He is begged to be Śiva or propitious, but the word is an epithet, not a proper name. He haunts mountains and deserted, uncanny places: he is the patron of violent and lawless men, of soldiers and robbers (the two are evidently  considered much the same), of thieves, cheats and pilferers, but also of craftsmen and huntsmen and is himself "an observant merchant": he is the lord of hosts of spirits, "ill-formed and of all forms." But he is also a great cosmic force who "dwells in flowing streams and in billows and in tranquil waters and in rivers and on islands ... and at the roots of trees ...": who "exists in incantations, in punishments, in prosperity, in the soil, in the threshing-floor ... in the woods and in the bushes, in sound and in echo ... in young grass and in foam ... in gravel and in streams ... in green things and in dry things.... Reverence to the leaf and to him who is in the fall of the leaf, the threatener, the slayer, the vexer and the afflicter." Here we see how an evil and disreputable god, the patron of low castes and violent occupations, becomes associated with the uncanny forces of nature and is on the way to become an All-God.
Rudra is frequently mentioned in the Atharva Veda. He is conceived much as in the Śatarudrîya, and is the lord of spirits and of animals. "For thee the beasts of the wood, the deer, swans and various winged birds are placed in the forest: thy living creatures exist in the waters: for thee the celestial waters flow. Thou shootest at the monsters of the ocean, and there is to thee nothing far or near."
These passages show that the main conceptions out of which the character of the later Śiva is built existed in Vedic times. The Rudra of the Yajur and Atharva Vedas is not Brahmanic: he is not the god of priests and orderly ritual, but of wild people and places. But he is not a petty provincial demon who afflicts rustics and their cattle. Though there is some hesitation between one Rudra and many Rudras, the destructive forces are unified in thought and the destroyer is not opposed to creation as a devil or as the principle of evil, but with profounder insight is recognized as the Lord and Law of all living things.
But though the outline of Śiva is found in Vedic writings, later centuries added new features to his cult. Chief among these is the worship of a column known as the Linga, the emblem under which he is now most commonly adored. It is a phallic  symbol though usually decent in appearance. The Vedas do not countenance this worship and it is not clear that it was even known to them. It is first enjoined in the Mahâbhârata and there only in two passages which appear to be late additions. The inference seems to be that it was accepted as part of Hinduism just about the time that our edition of the Mahâbhârata was compiled. The old theory that it was borrowed from aboriginal and especially from Dravidian tribes is now discredited. In the first place the instances cited of phallic worship among aboriginal tribes are not particularly numerous or striking. Secondly, linga worship, though prevalent in the south, is not confined to it, but flourishes in all parts of India, even in Assam and Nepal. Thirdly, it is not connected with low castes, with orgies, with obscene or bloodthirsty rites or with anything which can be called un-Aryan. It forms part of the private devotions of the strictest Brahmans, and despite the significance of the emblem, the worship offered to it is perfectly decorous. The evidence thus suggests that this cultus grew up among Brahmanical Hindus in the early centuries of our era. The idea that there was something divine in virility and generation already existed. The choice of the symbol—the stone pillar—may have been influenced by two circumstances. Firstly, the Buddhist veneration of stûpas, especially miniature stûpas, must have made familiar the idea that a cone or column is a religious emblem, and secondly the linga may be compared to  the carved pillars or stone standards erected in honour of Vishnu. Some lingas are carved and bear one or four faces, thus entirely losing any phallic appearance. The wide extension of this cult, though its origin seems late, is remarkable. Something similar may be seen in the worship of Ganeśa: the first records of it are even later, but it is now universal in India.
It may seem strange that a religion whose outward ceremonies though unassuming and modest consist chiefly of the worship of the linga, should draw its adherents largely from the educated classes and be under no moral or social stigma. Yet as an idea, as a philosophy, Śivaism possesses truth and force. It gives the best picture which humanity has drawn of the Lord of this world, not indeed of the ideal to which the saint aspires, nor of the fancies with which hope and emotion people the spheres behind the veil, but of the force which rules the Universe as it is, which reproduces and destroys, and in performing one of these acts necessarily performs the other, seeing that both are but aspects of change. For all animal and human existence is the product of sexual desire: it is but the temporary and transitory form of a force having neither beginning nor end but continually manifesting itself in individuals who must have a beginning and an end. This force, to which European taste bids us refer with such reticence, is the true creator of the world. Not only is it unceasingly performing the central miracle of producing new lives but it accompanies it by unnumbered accessory miracles, which provide the new born child with nourishment and make lowly organisms care for their young as if they were gifted with human intelligence. But the Creator is also the Destroyer, not in anger but by the very nature of his activity. When the series of changes culminates in a crisis and an individual breaks up, we see death and destruction, but in reality they occur throughout the process of growth. The egg is destroyed when the chicken is hatched: the embryo ceases to exist when the child is born; when the man comes into being, the child is no more. And for change, improvement and progress death is as necessary as birth. A world of immortals would be a static world.
When once the figure of Śiva has taken definite shape,  attributes and epithets are lavished on it in profusion. He is the great ascetic, for asceticism in India means power, and Śiva is the personification of the powers of nature. He may alternate strangely between austerities and wild debauch, but the sentimentality of some Krishnaite sects is alien to him. He is a magician, the lord of troops of spirits, and thus draws into his circle all the old animistic worship. But he is also identified with Time (Mahâkâla) and Death (Mrityu) and as presiding over procreation he is Ardhanareśvara, half man, half woman. Stories are invented or adapted to account for his various attributes, and he is provided with a divine family. He dwells on Mount Kailâsa: he has three eyes: above the central one is the crescent of the moon and the stream of the Ganges descends from his braided hair: his throat is blue and encircled by a serpent and a necklace of skulls. In his hands he carries a three-pronged trident and a drum. But the effigy or description varies, for Śiva is adored under many forms. He is Mahâdeva, the Great God, Hara the Seizer, Bhairava the terrible one, Paśupati, the Lord of cattle, that is of human souls who are compared to beasts. Local gods and heroes are identified with him. Thus Gor Bâba, said to be a deified ghost of the aboriginal races, reappears as Goreśvara and is counted a form of Śiva, as is also Khandoba or Khande Rao, a deity connected with dogs. Ganeśa, "the Lord of Hosts," the God who removes obstacles and is represented with an elephant's head and accompanied by a rat, is recognized as Śiva's son. Another son is Skanda or Kârtikeya, the God of War, a great deity in Ceylon and southern India. But more important both for the absorption of aboriginal cults and for its influence on speculation and morality is the part played by Śiva's wife or female counterpart.
The worship of goddesses, though found in many sects, is specially connected with Śivaism. A figure analogous to the Madonna, the kind and compassionate goddess who helps and pities all, appears in later Buddhism but for some reason this train of thought has not been usual in India. Lakshmî, Sarasvatî and Sîtâ are benevolent, but they hold no great position in popular esteem, and the being who attracts millions of worshippers  under such names as Kâlî, Durgâ, or Mahâdevî, though she has many forms and aspects, is most commonly represented as a terrible goddess who demands offerings of blood. The worship of this goddess or goddesses, for it is hard to say if she is one or many, is treated of in a separate chapter. Though in shrines dedicated to Śiva his female counterpart or energy (Śakti) also receives recognition, yet she is revered as the spouse of her lord to whom honour is primarily due. But in Śâktist worship adoration is offered to the Śakti as being the form in which his power is made manifest or even as the essential Godhead.
 See especially Dig. Nik. XX. and XXXII.
 But the lists may be pieces of folk-lore older than the suttas in which they are incorporated.
 The Dionysus of Megasthenes is a deity who comes from the west with an army that suffers from the heat of the plains. If we could be certain that he meant Śiva by Dionysus this would be valuable evidence. But he clearly misunderstood many things in Indian religion. Greek legends connected Dionysus with India and the East.
 Macdonell seems to me correct in saying (J.R.A.S. 1915, p. 125) that one reason why Indian deities have many arms is that they may be able to carry the various symbols by which they are characterized. Another reason is that worship is usually accompanied by dhyâna, that is forming a mental image of the deity as described in a particular text. E.g. the worshipper repeats a mantra which describes a deity in language which was originally metaphorical as having many heads and arms and at the same time he ought to make a mental image of such a figure.
 But some forms of Śivaism in southern India come even nearer to emotional Christianity than does Vishnuism.
 I cannot discover that any alleged avatâra of Śiva has now or has had formerly any importance, but the Vâyu, Liṅga and Kûrma Purâna give lists of such incarnations, as does also the Catechism of the Shaiva religion translated by Foulkes. But Indian sects have a strong tendency to ascribe all possible achievements and attributes to their gods. The mere fact that Vishṇu becomes incarnate incites the ardent Śivaite to say that his god can do the same. A curious instance of this rivalry is found in the story that Śiva manifested himself as Śarabha-mûrti in order to curb the ferocity of Vishṇu when incarnate in the Man Lion (see Gopinâtha Rao, Hindu Icon. p. 45). Śiva often appears in a special form, not necessarily human, for a special purpose (e.g. Vîrabhadra) and some tantric Buddhas seem to be imitations of these apparitions. There is a strong element of Śivaism borrowed from Bengal in the mythology of Tibet and Mongolia, where such personages as Hevajra, Saṃvara, and Mahâkâla have a considerable importance under the strange title of Buddhas.
 The passage from one epithet to the other is very plain in R.V. I. 114.
 Book XVI.
 In the play Mricchakaṭikâ or The Clay Cart (probably of the sixth century A.D.) a burglar invokes Kârtikeya, the son of Śiva, who is said to have taught different styles of house-breaking.
 A similarly strange collocation of attributes is found in Daksha's hymn to Śiva. Mahâbhârata, XII. Sec. 285.
 Atharva, V. xi. 2. 24.
 It is not certain if the Śisṇadevâh whom Indra is asked to destroy in Ṛig. V. VII. 21. 5 and X. 99. 3 are priapic demons or worshippers of the phallus.
 VII. secs. 202, 203, and XIII. sec. 14.
 The inscriptions of Camboja and Champa seem to be the best proof of the antiquity of Linga worship. A Cambojan inscription of about 550 A.D. records the dedication of a linga and the worship must have taken some time to reach Camboja from India. Some lingas discovered in India are said to be anterior to the Christian era.
 See F. Kittel, Ueber den Ursprung der Linga Kultus, and Barth, Religions of India, p. 261.
 As is also its appearance, as a rule. But there are exceptions to this. Some Hindus deny that the Linga is a phallic emblem. It is hardly possible to maintain this thesis in view of such passages as Mahâbh. XIII. 14 and the innumerable figures in which there are both a linga and a Yoni. But it is true that in its later forms the worship is purged of all grossness and that in its earlier forms the symbol adored was often a stûpa-like column or a pillar with figures on it.
 Such scenes as the relief from Amarâvati figured in Grünwedel, Buddhist art in India, p. 29, fig. 8, might easily be supposed to represent the worship of the linga, and some of Aśoka's pillars have been worshipped as lingas in later times.
 But not of course the soul which, according to the general Indian idea, exists before and continues after the life of the body.
 Crooke, Popular Religion and Folklore of Northern India, I. 84; II. 219.
 They are however of some importance in Vishnuite theology. For instance according to the school of Râmânuja it is the Śakti (Śrî) who reveals the true doctrine to mankind. Vishṇu is often said to have three consorts, Śrî, Bhû and Lîlâ.
 E.g. Śat. Brâh. I. 2. 5. See also the strange legend Ib. XI. 1. 1 where Vishṇu is described as the best of the gods but is eaten by Indra. He is frequently (e.g. in the Śata Brâh) stated to be identical with the sacrifice, and this was probably one of the reasons for his becoming prominent.
 See many modern examples in Crooke, Popular Religion and Folk Lore of Northern India, chap. IV. and Census of India, 1901, vol. VI. Bengal, pp. 196-8, where are described various deified heroes who are adored in Bengal, such as Goveiyâ (a bandit), Sailesh, Karikh, Lárik, Amar Singh, and Gobind Raut (a slayer of tigers). Compare too the worship of Gopi Nath and Zinda Kaliana in the Panjâb as described in Census of India, 1901, vol. XVII. pp. 118-9.
Source: Hinduism and Buddhism An Historical Sketch by Sir Charles Eliot.Vol I & II
You may check these links also.
Agamas, The Sacred Literature Of Saivism
Aspects and Manifestations Of Lord Siva
Bataraguru Or Divine Teacher - Siva In Malay Tradition
The Churning Of The Ocean - A Hindu Legend From Purana
The Dharma Of A Householder On The Path To Salvation
The Story Of The Great God Siva Or Mahadev
Maya, The Illusion or The Delusion Of The Embodied Soul
Symbolism of Nataraja, The Lord Of The Universal Dance
Pasa, the Impurities of Anava, Karma and Maya in Saivism
Pasu The Deluded Soul Caught In Animal Nature
Pati the Lord of Creation in Saivism
Sayujya, the Liberation of Souls
Shakti, the Dynamic Energy of Siva
Symbolism of Siva As the Breathing Body and Prana
The Symbolism and Worship of Sivalingas in Saivism
The 36 Tattvas and Their Significance
Siva--Ideal of Manhood, Embodiment of Godhead
How To Worship Lord Shiva or Siva and Shivalingam
The Growth of Hinduism From Vedic Religion
The History Of Shaivism In Southern India
A History of Shiva and Vishnu Worship
Ganesha Symbolism and Significance
Aspects of Shakti, The Mother Goddess
Kumara Swamy Symbolism and Significance