For example, when Doctor X says "its bad when celiac compromised people eat gluten", then in an argument I say "its bad when everyone eats gluten, not just celiac compromised people. I know this is true because Doctor X said so in his book (etc)". Here I quote the Doctor X but misrepresent his views to further my agenda. What would this fallacy be called? Thank you
In a court of law, where such misrepresentation is impermissible, it is called mischaracterization of previous testimony. The reason it is impermissible is that this method (also called lying) is very effective at swaying juries to arrive at unjust verdicts.
For this very reason, trial lawyers will try to get away with it as often as possible, which causes opposing counsel to repeatedly jump to their feet and say, "Objection! Mischaracterizes previous testimony!"
When you misrepresent someone's views for the purpose of refuting them, it's a strawman fallacy. What you described is related to the fallacy of quoting out of context, although in your case it is paraphrasing out of context.