Colloquial exclamation my foot! expressing "contemptuous contradiction" [OED] is first attested 1923, probably a euphemism for my ass, in the same sense, which dates back to 1796.
It makes sense, of course, that it would be a euphemized vulgarity. But you can never tell with these things. The expression 'my eye', meaning much the same thing, and which you think would be analogous, is apparently first attested in 1842, and its probable origin is an even earlier expression, 'All my eye', going back very early to 1768 (and note that the early date might mean that 'my ass' was itself a vulgarizing of 'my eye'), and also found in the only slightly later basically synonymous expression, 'All my eye and Betty Martin', which I think I'm going to have to start using. And one does find in the nineteenth century people using the expression, "My eye and my elbow".
So my suspicion is that it is actually a rather different situation, in which there were lots of expressions around already of the form "My [body part]" that all meant more or less the same thing, and so people just took it as a general form. Indeed, I know for sure that I've heard, and used myself, the expression "My big toe" in exactly the same way. The fact that there are so many of the same form strongly suggests to me that it's the form that's actually driving the history here, not euphemism. And one confirmation of this is that you can make up your own version using a body part probably nobody has ever used before, and still be completely understood. Try it today and contribute to philological research!