In this study, superior carbon nanotubes (CNT) were chemically modified with itaconic acid (IA) and a polyaniline (PANI) composite was formed and used to remove methylene blue (MB) dye from an aqueous solution. The capacity of CNTs modified with IA (IA/CNT) and composited with PANI (PANI/CNT) to remove MB dye from an aqueous solution was compared and investigated. The effects of parameters such as pH (3–10), adsorbent dose (0.8–8 g/L), initial dye concentration (10–100 mg/L), and temperature (25–55 °C) on MB adsorption were investigated. IA/CNT and PANI/CNT adsorbents were characterized by analyzes such as Fourier Transform Infrared Spectroscopy (FT-IR), Field Emission Scanning Electron Microscopy (FE-SEM), transmission electron microscope (TEM), and Brunauer, Emmett and Teller (BET). It was determined that the isotherm data fit the Langmuir isotherm model. The maximum adsorption capacity (qmax) of PANI/CNT and IA/CNT calculated according to this model (at 25 °C) was 12.78 and 32.78 mg g− 1, respectively. Thermodynamic analysis results showed that the adsorption was exothermic, feasible, and spontaneous. It can be said that the possible mechanism of MB on PANI/CNT and IA/CNT adsorbents occurs with the participation of π–π interaction, electrostatic attraction and hydrogen bonding.