Antibiotic fermentation residues (AR) are a potential biohazard to the environment and human health. Pyrolysis is an effective method that can be utilized to decompose residual antibiotics and convert AR into valuable products such as biofuels (bio-oils), biochars, and pyrolysis gas. The nitrogen element in AR affects the utilization of the products significantly. Clarifying the product characteristics and nitrogen migration mechanism of AR during pyrolysis will be helpful for the resource utilization of AR. In this study, pyrolysis experiments of penicillin fermentation residue (PR) were conducted at 400−700 °C. The cyclization of nitrogen from the protein/amino acids in PR facilitated the generation of pyrrole and pyridine. During this process, NH 3 , HCN, and HNCO were released into pyrolysis gas. When heated to 600−700 °C, the pyridine and pyrrole in the biochars produced quaternary nitrogen groups through condensation and generated HCN through secondary thermal cracking at the same time. The total content of nitrogen compounds in the bio-oil reached a maximum at 400 °C (57.3%). Amide, amine, pyridine, and indole were the principal nitrogenous species. Additionally, dipeptides and 2,5-piperazinedione (DKP) compounds, the important intermediates in protein/amino acid pyrolysis, were also found in the bio-oil. The formation and transformation processes of the main N-containing compounds in the bio-oil were analyzed using quantum chemical calculations. The reaction barrier and reaction energy of every reaction step were evaluated to determine the most energetically favorable reaction paths. The three most abundant amino acids in PR were used as model molecules for calculating the formation process of DKP. In addition, the results of the quantum chemical calculations indicated that DKP could decompose into nitriles, amides, and amines. Moreover, the formation and decomposition of pyridine, the decomposition of uracil, and the formation of indole were also analyzed by quantum chemical calculations.