The Nanda dynasty ruled in northern part of the Indian subcontinent during the 4th century BCE, and possibly during the 5th century BCE. In 326 BC, Alexander invaded India, after crossing the river Indus he advanced towards Taxila.
Greeks, Kushanas & Shakas had entered India through the North West side. Accepting the local religion would provide them the easiest way to achieve legitimacy of their rule. Since Buddhism was prevalent in the area at that time and it was provided easiest entry (Hinduism had st5rict caste based structure) so, they embraces Buddhism.