What actually causes a child to be born with deformities of the heart?

UNKNOWN. Majority is unknown. There are factors that may increase the chance of having congenital heart disease eg genetic or chromosomal abnormalities eg downs syndrome.Certain medication, alcohol or drug abuse during pregnancy.Maternal viral infection eg german measles in the first trimester of pregnancy. Also risk is higher if a parent or sibling has a congenital heart defect.
Interference/data. The formation of the heart requires that the embryo carry out a complex series of events in the proper sequence and proper time. This involves taking a tube structure, folding it, and forming walls and valves. If there is a bad set of instructions (chromosome defect,inherited genes) or interference (toxin,infection) the formation can go wrong.