We evaluated Paal−Knorr and Debus−Radziszewski reactions as the mechanisms underlying formation of pyrroles and imidazoles, respectively, in hydrothermal liquefaction (HTL) via semicontinuous HTL experiments on a glucose−glycine mixture. We developed cheminformatic-based HTL reaction pathways for a range of feedstock pH (2−12), reaction temperatures (280−370 °C), and reaction times (2−60 min). The developed pathways were validated using transient concentration of the reacting compounds and assessed using reversible power-law kinetics, Arrhenius equation, and Maxwell relation for Gibbs free energy. The assessment informed the exothermicity of both proposed mechanisms and their activation under acidic conditions with (1) succinaldehyde and amino acid/ammonia and (2) α-dicarbonyls, formaldehyde, and amino acid/ammonia as precursors, respectively. Endothermic amidation and exothermic decarboxylation followed both reactions, producing amide-and alkyl-substituted pyrroles and imidazoles in biocrude and an aqueous-phase coproduct. Moreover, exothermic C−C coupling of pyrroles and a series of exothermic Wittig olefination and Hoesch reactions involving dicarboxylic acid of imidazole, fumaronitrile, and ylide precipitated polypyrrole and azepine-and azocine-embedded imidazole in hydrochar. Meanwhile, the HTL of neutral and alkaline feedstocks presented a transition from alkali-catalyzed (e.g., the endothermic Maillard reaction between pyruvaldehyde and amino acid/ammonia producing pyrazines and oxazoles) to acidcatalyzed (e.g., the Debus−Radziszewski reaction) mechanisms at reaction times longer than 10 min due to significant acetic acid formation from the decomposition of carbohydrate and protein monomers. This study proved that the HTL mechanism of formation of N-heterocycles varied with feedstock pH.