Planar hexagonal boron nitride (h-BN) and tubular BN nanotube (BNNT), known for their superior mechanical and thermal properties, as well as wide electronic band gap, hold great potential for nanoelectronic and optoelectronic devices. Chemical vapor deposition has demonstrated the best way to scalable synthesis of high-quality BN nanomaterials. Yet, the atomistic understanding of reactions from precursors to product-material remains elusive, posing challenges for experimental design. Here, performing first-principles calculations and ab initio molecular simulations, we explore pyrolytic decomposition pathways of the most used precursor ammonia borane (H3BNH3, AB) to BN, in gas-phase and on Ni(111) or amorphous boron (for BNNT growth) surfaces, for comparison. It reveals that in the gas phase, a pair of AB molecules cooperate to form intermediate NH3 and ammonia diborane, which further dissociates into H2BNH2, accompanied by critical BH4- and NH4+ ions. These ions act as H scavengers facilitating H2BNH2 dehydrogenation into HBNH. The consequent HBNH directly feeds BN flake growth by reacting with the crystal edge, while the addition of H2BNH2 to the edge is prohibited at 1500 K. In contrast, on Ni and boron surfaces, AB monomer dehydrogenates stepwise, deeper, yielding BNH and BN dimer as the primary building unit. Our study maps out three typical experimental conditions regarding the dissociation of AB-precursor, providing insights into the underlying reaction mechanisms of gas-phase precursors, to help as guidelines for the experimental growth of BN nanomaterials.