In Latin Hercule was the vocative form of the name Hercles (or, as we would say in English, Hercules). That is, it is the form you would use if you were speaking directly to Hercules. Back in the day Romans did just this, speaking to Hercules when they needed a higher power to witness their words. Just as we might say "I swear to God!", the Romans would swear on the son of Hera, saying either Hercule! or "me Hercule!" to signify that they were telling the truth. It was also used as a mild oath or swear word, or simply an excited interjection (just as we might use "by God!"). It is usually translated as "by Hercules!" in English.
Over time this came to be written in a number of variations, including hercle, mehercle, mehercule. Women did not swear by Hercules, but instead by the name of Castor (me Castor!). Both men and women might also swear by Pollux (edepol!). These supplemented, but not not completely replace, the older me dius fidius that had been used before the Greek influence started to change the Roman language.