It has biblical origins in the book of Genesis in the Holy Bible, which tells the story of the sinful cities of Sodom and Gamorrah. The term comes from the Ecclesiastical Latin: pecatum Sodomiticum, or "sin of Sodom".
In religion the term "sodomy" is generally interpreted as referring to both oral sex and anal intercourse, as well as bestiality.
However, this can presumably mean many other types of sexual encounters; it is not unreasonable to classify kinky and/or fetish-based sex as sodomy.
So if you think it only means buttsex or gay sex, you've obviously never looked it up in a REAL dictionary.
-Eww, no! We just had oral sex.
That's still technically sodomy, y'know.
"I am a gentleman who likes to partake in sodomy with other fellows on the veranda after my morning tea."