We argue that contemporary magnetic fields in the radiative cores of solar-type stars are relics of hydromagnetic dynamos operating over the pre-main sequence epoch when the core formed. Simulations of differential rotation and dynamos of a 1 M. star are performed for a sequence of evolutionary stages of the core-growth epoch. A big difference in the dynamo-generated field between the initial and final stages of the core formation is predicted. An axisymmetric and cyclic field similar to the present day Sun is excited in a star with a mature radiative zone. An infant Sun with its core just starting to grow generates a nonaxisymmetric global field which is steady in a rotating frame. A qualitative explanation for the nonaxisymmetry is sugges...