The magnetic fields of many planets are approximately axial dipoles. To understand why the dipole is preferred, the evolution in time of a seed magnetic field is studied using a rotating dynamo model. It is shown that the growing magnetic field by itself excites helical convection over a range of length scales within the dynamo region [figure (a)]. The time scale for the growth in convection intensity roughly coincides with the time scale for the formation of the dipole [figure (b)]. It is also shown that the dipole forms from a chaotic state well before the eventual saturation of the magnetic field, implying that a planetary dynamo would have chosen its dominant polarity during its growth phase, i.e. during the early life of the planet.