This study presents an innovative, single‑step synthesis approach for producing porous activated carbon (AC) from palm kernel shells (PKS). A high‑quality AC was produced by integrating CO2 and ZnCl2 into the carbonization process as activating agents. The pyrolysis parameters, including activation temperature, residence time, activating agent ratio, and heating rate, were optimized using response surface methodology (RSM) to assess the yields and specific surface area (SSA) of the resultant AC. The experimental design was based on a central composite design (CCD), and the process variables were analyzed to understand their interactions and combined effect on the properties of the AC. Further, the extreme gradient boosting (XGB) and random forest (RF) machine learning regressor models predicted the pyrolysis performance and aligned well with the experimental data. The results revealed that optimal conditions were achieved at an activation temperature of 800°C, a heating rate of 10°C/min, and a residence time of 2.75 h with the activating agent to biomass ratio of 1.25, yielding 33% AC with a surface area of 1420 m2/g and significant pore development. This study provides a scalable and environmentally friendly approach to valorizing agricultural waste into value‑added products by supporting the goals of the circular economy and net‑zero initiatives.