Novel hierarchical porous carbon materials (HPCs) were fabricated via a reactive template-induced in situ hypercrosslinking procedure. The effects of carbonization conditions on the microstructure and morphology of HPC were investigated, and the adsorption of methylene blue (MB) on HPC was explored. The as-prepared HPC has a hierarchical micro-, meso- and macropore structure, which results from the overlap of hollow nanospheres possessing microporous shells and macroporous cavities. The carbonization temperature, carbonization time and carbonization heating rate played important roles in tailoring the nanostructures of HPC. The BET specific surface area and micropore specific surface area can reach 2388 m2·g−1 and 1892 m2·g−1, respectively. Benefitting from the well-developed pore structure, the MB removal efficiency can reach 99% under optimized conditions. The adsorption kinetics and thermodynamics can be well described by a pseudo-second-order model and Langmuir model, respectively. Furthermore, such adsorption is characterized by a spontaneous endothermic process.