Does transposition of the great vessels happen because of genetics?

Yes and no. There are many genetic syndromes in which a cardiac malformation occurs, including transposition. However, there are other causes as well, such as the fetal effects of maternal diabetes, exposure to substances which can cause birth defects, and reduced folic acid in pregnancy. There are unknown patterns of malformations which we do not understand--heart defects with renal, ear, and vertebral.
No. Transposition is one of the only congenital heart defects that has no increased risk of recurrence in families.