The Cathars, also known as the Albigensians, were a gnostic movement centered in Languedoc, and were active from the 11th to the 13th centuries. Their orthodox enemies (falsely) accused them of transgressive sexual practices, including the traditional Big No-No: sodomy.* The Albigensian heresy had historical and philosophical ties to heretical movements in Bulgaria, so the Cathars were popularly called Bulgarians—or bougres, in Old French.
Talk of the bougres of Languedoc filtered to England via the Normans, and over the years the unspeakable bougre vice became known as buggery.
So for their contributions to the development of the word “bugger,” you can thank the Catholic Church, ignorance of basic European geography, and paranoia about what people do with their butts.
*Given that “sodomy” has for centuries been perceived as a grave threat to Life, the Universe, and Everything, it is a perpetually ill-defined alleged danger. Twelfth century chroniclers Orderic Vitalis and William of Malmesbury, for instance, associate fancy court clothes and those curly-toed Medieval shoes with “foul sodomite-things.” But that’s a story for another day.
Source: Mills, Robert. “Male-Male Love and Sex in the Middle Ages, 1000-1500.” In A Gay History of Britain: Love and Sex Between Men Since the Middle Ages, ed. Matt Cook, 1-43. Oxford: Greenwood World Publishing, 2007.