Abstract The dye and heavy metal are two principal concomitant pollutants in industrial wastewaters, posing a serious threat to public health and the environment. Herein, we developed a novel strategy to convert banana peels into hierarchically porous carbon (BPCA) and porous carbon oxide (BPCAO) for the simultaneous removal of methylene blue (MB) and Co(II). The as-prepared carbons were systematically characterized by SEM, TEM, BET, FT-IR and XPS. Compared to BPCA, BPCAO showed a better adsorption performance due to its abundant surface oxygen-containing groups. In the mono-component systems, both MB and Co(II) adsorption onto BPCAO were well described by the pseudo-second-order and Langmuir models. The maximum adsorption capacities of MB and Co(II) were calculated to be 1303.54 and 122.39 mg/g at 298 K, respectively. In the binary system, the interaction between MB and Co(II) was determined and it depended on the initial concentration of Co(II). The adsorption mechanism of MB involved electrostatic interaction, π-π stacking and hydrogen-bonding while that of Co(II) was mainly ruled by the complexation and/or ion-exchange. This study indicated BPCAO could be a favorable biomass-derived adsorbent for the simultaneous removal of the dye and heavy metal.