When we talk about “same sex” attractions or relationships in the ancient world, we need to be mindful that our modern perceptions of this may be completely different to what the ancient people had in mind. Additionally, as many records tend to be fragmentary it leaves them open to interpretations. The examples which I have provided here draw upon other scholar’s interpretations as well as the primary evidence.
The earliest which I can think of would be from The Epic of Gilgemesh, the oldest version of the text originates from c.2100 BC. However there are other versions of the text which range in dates from 13th to 10th centuries BC. Due to this, many translations draw on multiple versions to provide a translated work. Numerous scholars pointed towards it as having (to an extent) homosexual undertones and according to Held (1983: 136) the relationship between Gilgemesh and Enkidu was alluded to in a poetic style by the writer (s). He quotes the following to make his point:
‘I looked at it [i.e the axe] and I rejoiced, Loving it and bending over it As (over) a woman I took it and put it At my side (2.I 32-36)
However there are also the following lines, which make it more obvious:
"My son, the axe you saw is a friend, like a wife you'll love him, caress and embrace him, and I, Ninsun, I shall make him your equal. I A mighty comrade will come to you, and be his friend's saviour, mightiest in the land, strength he possesses, his strength is as mighty as a rock from the sky." (I.287-293)
Additionally, there is an example from a tomb from Old Kingdom Egypt called "The Tomb of Khnumhotep and Niankhkhnum". The tomb dates to the 5th Dynasty (Appx 2400 BC) and is different to what you would normally find in Egypt as it was constructed for two male occupants. The male occupants are depicted throughout the tomb and in one scene are depicted embracing. However, there is no written evidence to suggest that they were in fact lovers, and in some scenes they are depicted with their families. Due to this issue, scholars argue that they may have been brothers. The other example that I can think of also comes from Egypt, whilst this is not directly “same sex” relationship, it relates to hermaphrodites and eunuchs. There is a New Kingdom story called “The Tale of Two Brothers” where the man cuts off his own penis and becomes a woman (Wilfong 2010: 167).
Additionally, Lise Manniche (1987: 14-15) writes that in Egyptian Myth homosexuality was “performed as an act of violence against an enemy”. This is shown in the “Story of Horus and Seth” from the P. Chester Beaty I, 11.2, where the following takes place “But during the night, Seth caused his phallus to become stiff and inserted it between Horus's thighs. Then Horus placed his hands between his thighs and received Seth's semen.”
I hope this helps you understand, and that it answers your question to some extent.
Epic of Gilgemesh, transl. A. George, The Babylonian Epic Poem and Other Texts in Akkadian and Sumerian, Oxford, 2003.
Held, G. 1983 “Parallels between The Gilgamesh Epic and Plato's Symposium” Journal of Near Eastern Studies 42 No. 2, 133-141.
Manniche, L. (1987) Sexual Life in Ancient Egypt, London.
Wilfong, T. G., (2010) “Gender in Ancient Egypt” in W. Wendrich (ed) Egyptian Archarology, Oxford, pp. 164 -179.