this is happening because of a thing called "Apply Root Motion" in the animator component attached to the animated character, untick or uncheck "Apply Root Motion" and it will be fine
1. Right click in animator tab and select "Create State"
2. Right click that state and select "Set as Layer Default State"
myAnimation.gameObject.GetComponent<Animator>().enabled = false;