Firstly, I would like to clarify that this answer is based on personal thoughts and does not have scriptural verification.
Adam was probably first created without a gender. The name Adam, meaning "son of red earth", was first mentioned in Genesis 3:17, after Eve was created in Genesis 2:22. Before Eve was created, the Lord referred to Adam as "the Human", in Sefaria.org Hebrew-English translation, instead of "the man" as found in most English Bibles.
In most English Bibles, Eve's creation is described as being taken from the ribs of the man. However, in Sefaria.org Hebrew-English translation, it is described as being taken from the sides of the Human.
Now we know the human cells containing 23 pairs of chromosomes, and one pair determining the sex of a human. This microscopic knowledge was far beyond the comprehension of people in Moses' time. Based on Sefaria.org Hebrew-English translation, "Human" is used instead of "man", and "Sides" instead of "chromosomes", I would speculate that Adam was created without a gender. When the Lord decided "the Human" was not good to be alone, He created the marker in one pair of chromosome, each pair being a spiral thread-like structures tightly link side by side. Perhaps this is what "sides" meant.
After Eve was created, "the Human" became Adam, indicating that their gender was established. From that point on, human procreation became possible.