Terminology for turning an idiom's meaning around
Just recently, I used the idiom comparing apples and oranges in an argument with someone when they compared two vastly different mathematical fields and claimed that, because deep learning neural networks could solve one problem, it would not be long before it could solve the other. Rather than ask what differences are relevant, they made the comment that, in the grand scheme of things, apples and oranges are actually very similar (which is true, but irrelevant).
What is the term for what they did when inverting the meaning of that idiom?
Solution 1:
There seems to me to be two questions here but perhaps you only intend one of them - if so, apologies!
Inverting the idiom: are there any idioms for this?
First of all, you are exactly right: you can say that they inverted the idiom on you and there is no problem with that, although, of course, it isn't terribly idiomatic.
There is an idiom (with more or less the same literal meaning) that you might also use: you could say he or she turned the argument (or idiom etc.) on its head or stood the analogy on its head.
In my own limited experience turned on its head is more common than stood on its head. Your mileage may vary here; this dictionary gives the stood version form more prominence in its listing, though its examples are more heavy on the turned:
stand (or turn) something on its head (phrase)
Completely reverse the principles or interpretation of an idea or argument.
‘a book that turns the accepted view of modernism on its head’
‘punk had turned pop music and its attendant culture in its head’
‘In Asia, a debate about the importance of Asian values got underway, with the state-business elite turning the liberal idea on its head, and arguing that individualism and pluralism actually negated economic success.’
However, while turned on its head is fine for an academic context or, say, print journalism, talking like that is likely to get you laughed out of the pool hall, if not stood on your own head in the process.
More casually, they flipped it on you or flipped it round on you. It's difficult to get a dictionary to back this up beyond the simple definitions of flip meaning to swap places or to turn over but note that, once again, the phrases are very similar in their literal meaning to that of invert.
Similarly, but less specifically, they turned the tables on you:
Oxford Living Dictionaries:
Turn the tables (phrase)
Reverse one's position relative to someone else, especially by turning a position of disadvantage into one of advantage.
‘Police invited householders to a seminar on how to turn the tables on burglars.’
‘He times it carefully, and quickly turns the tables on the hermit, pressing his attack and his advantage.’
The logical fallacy: is there an idiom for what they did there?
Most of those phrases imply that the other person won the argument; they didn't - any victory was superficial as there is, of course, another key aspect to what they did in their inversion of your idiom. In taking your analogy out of context, they are engaging in rhetoric over logic.
As they are attacking a misrepresentation of your position, this is a form of the straw man fallacy:
Wikipedia:
A straw man is a common form of argument and is an informal fallacy based on giving the impression of refuting an opponent's argument, while actually refuting an argument that was not presented by that opponent. One who engages in this fallacy is said to be "attacking a straw man."
The typical straw man argument creates the illusion of having completely refuted or defeated an opponent's proposition through the covert replacement of it with a different proposition (i.e., "stand up a straw man") and the subsequent refutation of that false argument ("knock down a straw man") instead of the opponent's proposition.
(Note that this is more of a technical term than an idiom.)
It is also an example of the informal fallacy of style over substance:
Rational Wiki:
“If you can't dazzle them with brilliance, baffle them with bullshit.”
W.C. Fields
Style over substance is a logical fallacy that occurs when someone bases their argument on compelling language, obfuscation, and various terms of art, instead of legitimate logical analyses. The fallacy works in two ways. It can propose an idea using style rather than substance, or it can reject an idea by attacking its style and presentation rather than its information content.
Style over substance is an idiom but this is a specific use of it that is not quite the same as the general case.
These kinds of rhetorical flourish can all sound very convincing, but, upon examination, they are bluff, glib, specious, disingenuous, fallacious, bluster and meaningless; they are sophistry:
Sophistry (noun, mass noun)
The use of clever but false arguments, especially with the intention of deceiving.
‘Trying to argue that I had benefited in any way from the disaster was pure sophistry.’
‘It must be confessed that there is an air of sophistry about this argument - and I certainly have doubts about its cogency.’
Again, though this is a perfectly good way to refer to this form of argument - especially as sophistry has the specific connotation of playing meaningless games with words - it is not an idiom.
However, it might work well in combination with one of the other phrases referring to inverting the idiom. One possible combination:
They seemed to turn the tables on me with a glib bit of sophistry.
Solution 2:
The technical term in rhetoric is a false equivalence. Apples and oranges cannot be compared because it is a logical fallacy to presume that they are equivalent. The rhetorical argument your opponent used on you is an argument that turns on the definition of apples and oranges, saying they are all fruit. If I were on my game I might retort: that’s a fruity and speculative argument, but if you have ideas about how mathematically, deep NNs can be applied either equivalently or nearly so, across the different problem sets, I’d be interested to hear it. Which is a very fancy way to ask the rhetorical question, “Why don’t you prove it?”