Courtesy: https://twitter.com/v_shuddhi/status/1553199241417605120?s=24&t=7jDzemqnGKOnEZZ-fOZ7WA
Why the Ancient Vedic Rishis created the Gotra system, why did they bar marriage between a boy and a girl belonging to the same Gotra and why only son carries the gotra of father why not daughter?

The Gotra is a system which associates a person with his most ancient or root ancestor in an unbroken male lineage. So Gotra refers to the root person (मूल पुरुष) in a person’s male lineage.
The word Gotra is formed from the two Sanskrit words Gau (Cow) and Trahi (meaning Shed). So Gotra means Cowshed, where in the context is that Gotra is like the Cowshed protecting a particular male lineage. it will be like a brother marrying a sister which is known to cause genetic disorders in their offspring
A Bride and a Bridegroom belonging to the same Gotra are considered to be siblings. The reason given was since they belonged to the same ancestor.
Humans have 23 pairs of Chromosomes and in each pair one Chromosome comes from the father and the other comes from the mother. So in all we have 46 Chromosomes in every cell, of which 23 come from the mother and 23 from the father. Of these 23 pairs, there is one pair called the “Sex Chromosomes” which decide the gender of the person. During conception, if the resultant cell has XX sex chromosomes then the child will be a girl and if it is XY then the child will be a boy.
X chromosome decides the female attributes of a person and Y Chromosome decides the male attributes of a person.
Since only men have Y Chromosomes, son always gets his Y Chromosome from his father and the X Chromosome from his mother.