We perform first-principles pseudopotential calculations to study the influence of Mn doping on the stability of two polytypes, wurtzite and zinc-blende, in GaN. In Mn delta-doped GaN and GaMnN alloys, we find similar critical concentrations of the Mn ions for stabilizing the zinc-blende phase against the wurtzite phase. Using a slab geometry of hexagonal lattices, we find that it is energetically unfavorable to form inversion domains with Mn exposure, in contrast to Mg doping. At the initial stage of epitaxial growth, a stacking fault that leads to the cubic bonds can be generated with the Mn exposure to the Ga-polar surface. However, the influence of the Mn delta-doped layer on the formation of the cubic phase is only effective for GaN layers deposited up to two monolayers. We find that the Mn ions are energetically more stable on the growth front than in the bulk, indicating that these ions act as a surfactant. Thus it is possible to grow cubic GaN if the Mn ions are periodically supplied or diffuse out from the Mn delta-doped layer to the growth front during the growth process.