This study aimed to understand the adsorption process of cephalexin (CPX) from aqueous solution by a biochar produced from the fiber residue of palm oil. Scanning electron microscopy, Fourier transform infrared spectroscopy, Boehm titration, and the point of zero charge were used to characterize the morphology and surface functional groups of the adsorbent. Batch tests were carried out to evaluate the effects of the solution pH, temperature, and antibiotic structure. The adsorption behavior followed the Langmuir model and pseudo-second-order model with a maximum CPX adsorption capacity of 57.47 mg g−1. Tests on the thermodynamic behavior suggested that chemisorption occurs with an activation energy of 91.6 kJ mol−1 through a spontaneous endothermic process. Electrostatic interactions and hydrogen bonding represent the most likely adsorption mechanisms, although π–π interactions also appear to contribute. Finally, the CPX removal efficiency of the adsorbent was evaluated for synthetic matrices of municipal wastewater and urine. Promising results were obtained, indicating that this adsorbent can potentially be applied to purifying wastewater that contains trace antibiotics.