Ionic liquids are potentially toxic to the environment, how to control the toxicity of ionic liquids is one of the key factors. To understand their toxicity mechanisms, three traditional machine learning methods (support vector machine, random forest, multilayer perceptron) and three graph neural network models (graph attention network, message passing neural network, graph convolutional model) were established to predict the toxicity of ionic liquids in four living organisms (leukemia rat cell line IPC-81, acetylcholinesterase, Escherichia coli, and Vibrio fischeri). The simplified molecular-input line-entry system (SMILES) of molecules and toxicity lgEC50 values work as the input and output respectively. In the three traditional machine learning methods, extended-connectivity fingerprints (ECFPs) were used to represent molecules. While in the three graph neural network models, molecular graphs were used to represent molecules. Benefiting from molecular structure information, the graph convolutional model (GCM) had lower RMSE and MAE, and higher R2 than other models in all four datasets. Therefore, the GCM model was superior in predicting the toxicity of ionic liquids. Meanwhile, based on the GCM model, an intepretability model was established to analyze the contribution of atomic groups to the toxicity of ionic liquids in a data-driven procedure. The aromatic ring of cations and long alkyl chain could produce toxicity. Atomic groups such as S+, P+, N+, and NH+ could significantly enhance the toxicity of ionic liquids, while atomic groups such as P-, F, B-, and C could effectively reduce the toxicity of ionic liquids. This discovery provides a theoretical basis for rapid screening and development of greener and low-toxicity ionic liquids.