Many scholars have suggested that the deity identified as Herakles was Krishna. Edwin Francis Bryant adds the following in this regard:
According to Arrian, Diodorus, and Strabo, Megasthenes described an Indian tribe called Sourasenoi, who especially worshipped Herakles in their land, and this land had two cities, Methora and Kleisobora, and a navigable river, the Jobares. As was common in the ancient period, the Greeks sometimes described foreign gods in terms of their own divinities, and there is a little doubt that the Sourasenoi refers to the Shurasenas, a branch of the Yadu dynasty to which Krishna belonged; Herakles to Krishna, or Hari-Krishna: Mehtora to Mathura, where Krishna was born; Kleisobora to Krishnapura, meaning "the city of Krishna"; and the Jobares to the Yamuna, the famous river in the Krishna story. Quintus Curtius also mentions that when Alexander the Great confronted Porus, Porus's soldiers were carrying an image of Herakles in their vanguard.
— Krishna: a sourcebook, Edwin Francis Bryant, Oxford University Press US, 2007
An ancient depiction of Baladeva, literally meaning, 'god of strength'. He was the elder brother of Krishna. James Tod associated Megasthenes' Herakles with this ancient Indian deity.
James Tod associated Herakles primarily with Baladeva, Krishna's older sibling, but also indicated that Herakles could be associated with both:
How invaluable such remnants of ancient race of Harikula! How refreshing to the mind yet to discover, amidst the ruins on the Yamuna, Hercules (Baldeva, god of strength) retaining his club and lion's hide, standing on his pedestal at Baldeo, and yet worshipped by Suraseni! This was name given to a large tract of country round Mathura, or rather round Surpura, the ancient capital founded by Surasena, the grandfather of the Indian brother-deities, Krishna and Baldeva, Apollo and Hercules. The title would apply to either ; though Baldeva has the attributes of 'god of strength'. Both are es (lords) of the race (kula) of Hari (Hari-kul-es), of which the Greeks might have made the compound Hercules.
— James Tod, Annals and Antiquities of Rajasthan 
According to Quintus Curtius, the Sibae, whom he calls Sobii, occupied the country between the Hydaspes and the Akesines. They may have derived their name from the god Siva.
Again when Alexander had captured at the first assault the rock called Aornos, the base of which is washed by the Indus near its source, his followers, magnifying the affairs, affirmed that Herakles had thrice assaulted the same rock and had been thrice repulsed. They said also that the Sibae were descended from those who accompanied Herakles on his expedition, and that they preserved badges of their descent, for they wore skins like Herakles and carried clubs, and branded the mark of a cudgel on their oxen and mules.
— Ancient India as described by Megasthenes and Arrian - Dr. Schwanbeck and J.W. McCrindle (1877), pp. 128–129 
According to Dr. Schwanbeck and J.W. McCrindle, Megasthenes meant Siva when he mentioned Herakles in his book Indika
Such, then are the traditions regarding Dionysus and his descendants current among the Indians who inhabit the hill-country. They further assert that Herakles also was born among them. They assign to him like Greeks, the clubs and the lion's skin. He far surpassed other men in personal strength and prowess, and cleared sea and land of evil beasts. Marrying many wives he begot many sons, but one daughter only. The sons having reached man's estate, he divided all India into equal portions for his children, whom he made kings in different parts of his dominion. He provided similarly for his daughter, whom he reared up and made a queen. He was the founder, also, of no small number of cities, the most renowned and greatest of which he called Palibothra (Pataliputra). He built therein many sumptuous palaces, and settled within its walls a numerous population. The city he fortified with trenches of notable dimensions, which were filled with water introduced from the river. Herakles, accordingly, after his removal from among the men, obtained immortal honor; and his descendants, having reigned for many generations and signalized themselves by great achievements, neither made any expedition beyond the confines of India, nor sent out any colony abroad. At last however, after many years had gone, most of the cities adopted the democratic form of government, though some retained the kingly until the invasion of the country by Alexander.
— Ancient India as described by Megasthenes and Arrian - Dr. Schwanbeck and J.W. McCrindle (1877), pp. 57–58