Wayang is a generic term denoting traditional theatre in Indonesia. There is no evidence that wayang existed before Hinduism came to Southeast Asia sometime in the first century CE. However, there very well may have been indigenous storytelling traditions that had a profound impact on the development of the traditional puppet theatre. The first record of a wayang performance is from an inscription dated 930 CE which says "si Galigi mawayang," or "Sir Galigi played wayang". From that time till today it seems certain features of traditional puppet theatre have remained. Galigi was an itinerant performer who was requested to perform for a special royal occasion. At that event he performed a story about the hero Bima from the Mahabharata.
Hinduism arrived in Indonesia from India even before the Christian era, and was slowly adopted as the local belief system. Sanskrit became the literary and court language of Java and later of Bali. The Hindus changed the Wayang (as did the Muslims, later) to spread their religion, mostly by stories from the Mahabharata or the Ramayana. Later this mixture of religion and wayang play was praised as harmony between Hinduism and traditional Indonesian culture. On Java, the western part of Sumatra and some smaller islands traditionalists continued to play the old stories for some time, but the influence of Hinduism prevailed and the traditional stories either fell into oblivion or were integrated into the Hinduistic plays.