Solid biofuel is considered as a possible substitute for coal in household heat production because of the available and sustainable raw materials, while NOx emissions from its combustion have become a serious problem. Nitrogen-containing compounds in pyrolysis products have important effects on the conversion of fuel-N into NOx-N. Understanding these converting pathways is important for the environmentally friendly use of biomass fuels. The nitrogen migration during pyrolysis of raw and acid leached maize straw at various temperatures was investigated in this study. Thermal gravimetric analysis and X-ray photoelectron spectroscopy were used to investigate the performances of thermal decomposition and pyrolysis products from samples. The main nitrogen functional groups in biomass and biochar products were N-A (amine-N/amide-N/protein-N), pyridine-N, and pyrrole-N, according to the findings. The most common gaseous NOx precursor was NH3, which was produced primarily during the conversion of N-A to pyridine-N and pyrrole-N. The formation of HCN mainly came from the secondary decomposition of heterocyclic-N at high temperatures. Before the pyrolysis temperature increased to 650 °C, more than half of the fuel-N was stored in the biochar. At the same pyrolysis temperature, acid-leached maize straw yielded more gas-N and char-N than the raw biomass. The highest char-N yield of 76.39 wt% was obtained from acid-leached maize straw (AMS) pyrolysis at 350 °C. Low pyrolysis temperature and acid-leaching treatment can help to decrease nitrogen release from stable char structure, providing support for reducing nitrogenous pollutant emissions from straw fuel.