We apply the ab initio no-core shell model/resonating group method approach to calculate the cross sections of the 3H(d,n)4He and 3He(d,p)4He fusion reactions. These are important reactions for the Big Bang nucleosynthesis and the future of energy generation on Earth. Starting from a selected similarity-transformed chiral nucleon-nucleon interaction that accurately describes two-nucleon data, we performed many-body calculations that predict the S-factor of both reactions. Virtual three-body breakup effects are obtained by including excited pseudostates of the deuteron in the calculation. Our results are in satisfactory agreement with experimental data and pave the way for microscopic investigations of polarization and electron screening effects, of the 3H(d,gamma)5He radiative capture and other reactions relevant to fusion research.