Both Mahayana and Theravada Buddhism are third-generation traditions, both arising from the original Buddhist community centered around Shakyamuni Buddha the founder. After the Buddha passed into Nirvana or “unbinding”, the community gradually evolved into many schools, based on local geography, and subtle differences in interpretation. Of these schools, the Theravada tradition arose from the Sthavira school, while the Mahayana arose from the Mahasangika school. Both inherited a full collection of sutras, which comprised the teachings of the Buddha, and both inherited the same basic monastic tradition, rules and regulations.
The Mayahana tradition in particular arose in the 1st century BC as a kind of tradition within existing schools. It included many great philosophers and teachers such as Nagarjuna, Asanga and Vasubandhu, who invigorated Buddhism at the time with new ideas and new ways to appreciating the Dharma, then helped it spread north along the Silk Road into Persia where it may have picked up religious iconography from the state Zoroastrian religion. From Persia, it then spread east into China where it competed with native Confucianism and Taoism, developed even further, than spread along with Chinese technology, art and culture to other countries in Asia. Satellite countries such as Japan, Korea, Okinawa, Vietnam and such equated Buddhism with Chinese culture and sophistication, so Buddhism frequently was adopted by the nobility before it took root in broader society.
Even while it spread outside of India, Mahayana Buddhism continued to develop for centuries in India, and contacts with China and Tibet helped keep the flow of information going until at last Buddhism in India was destroyed in the 11th century by invaders. By this time, Buddhism had already faded and declined compared to the newly risen Hindu religion and was barely hanging on in its native land.
Nevertheless, Mahayana Buddhism had taken root in other cultures by that point, and carried on into what we see today.