I know very little about religion, theology, or religious history, nor do I know much about the specific teachings or scriptures of any modern descendant or branches of the three Abrahamic religions (namely Christianity, Judaism, and Islam). However, I do know that most religious followings belonging to these groups have negative views on LGBTQ+ people, and specific teachings against same-sex romantic and sexual behaviors listed in their holy texts and taught in their faiths, at least in the current era.
Are their any historical reasons why all three major branches of the Abrahamic religions and their offshoots regard same-sex behavior as wrong? Either from when they were first forming and their holy texts were first being by written in ancient times, or from later subsequent events in history that caused these views to develop? I’ve heard people mention both trying to stop pagans as well as something to do with ritual warfare, but if either of those are the case I’d like to hear an in depth explanation as well as sources. I’ve asked this question here multiple times before and it has yet to be answered, so I really do appreciate any answers.
The short answer is that all three are heirs of a textual and religious traditon that incorporated a specific text known to scholars as the 'Holiness Code'. This is found in modern Bibles as Leviticus Chapters 17-26. Within this code, there are two references to same-sex sexual behaviour, Leviticus 18:22 and Leviticus 20:13.
There is a great deal of scholarly debate on the precise meaning of these two verses today, with scholars agonising over the precise definitions of the words, and whether they refer to all same-sex sexual activity, or just subsets (e.g. only prohibiting same-sex sex between members of the same family (the incest argument), or only with a male child (the paedophlia argument), or only with another woman's husband (the adultery argument)). However, there seems to have been no such debate in ancient Israel. From what we can tell from ancient Jewish writers, all same-sex sexuality was understood to be strictly prohibited.
The historical reason why this was prohibited is unfortunately something of a mystery. The textual justification is found in Leviticus 18:24-30, where the author explains that it was due to the aforementioned acts (not just same-sex behaviour, but all the illicit acts of chapter 18) that the Canaanites were "vomited out" of the land of Canaan. (It is noteworthy that this represents a different origin tradition for the Israelites' arrival in Canaan. Rather than the more famous "conquest narrative" of the book of Joshua, we see evidence of an alternative tradition that the Canaanites were dispossessed by natural processes before the Israelites moved in to take possession. Possibly this "vomiting out" is a metaphor for famine or other natural disaster which left the Canaanites socio-politically weakened, and their cities underpopulated or abandoned).
However we have no historical evidence for Canaanite sexual practices except for this very late, and polemical rhetoric (athough the Holiness Code is sometimes argued to predate the exile and the earlier material in Leviticus 1-16, other scholars such as Milgrom have argued that it is actually later, and represents the same hand as the final editor of Leviticus). It is possible that the ancient Canaanites did normalise same-sex relationships, and that because of this the Israelites believed this was a cause of the vague disaster that destroyed them, and so sought to avoid the same "mistake". However it is far more likely that there were other reasons, and this was just post-hoc polemic.
A better explanation would be to see the prohibition as part of a consistent priestly perception of "purity", and the various rules that developed to preserve and protect that purity. This framework is complex, but essentially it seeks to maintain a space wherein Israel's national god may dwell, thus allowing him to bless Israel with his presence. By strictly dilineating between what is pure and impure, the space is preserved, and God's presence is guaranteed. When the space is polluted, God's presence leaves, and disaster befalls the nation.
Some acts were understood to only bring temporary impurity, which can be removed with temporary exclusion from the sacred, and specific ritual practice (e.g. menstruation, childbirth, touching a dead body, coming into contact with a skin disease, mold, etc.). However some acts were understood to pollute the land itself and cannot be expunged, except by permenantly removing the person responsible, through exile or execution.
The acts that cause this permenant pollution of the land are murder, illicit sexual activity, and idolatry. These acts make the entirety of the nation impure, and in consequence less able to bear the presence of God. Eventually, it was believed that too much of this activity would taint the land so much that god would abandon the land altogether, and disaster would befall the nation.
Some good sources on this are:
Milgrom's three volume Anchor Yale Commentary on Leviticus,
Berlin and Brettler (eds) Jewish Study Bible 2e (specifically the essay 'Concepts of Purity in the Bible', by Jonathan Klawans), and
Barton and Muddiman (eds) Oxford Bible Commentary.
You also may want to try r/academicbiblical