We present a novel approach to accelerate the electromagnetic simulations by the multilevel fast multipole algorithm (MLFMA). The strategy is based on a progressive elimination of the electromagnetic interactions, resulting in trimmed tree structures, during iterative solutions. To perform such eliminations systematically, artificial neural network (ANN) models are constructed and trained to estimate the errors in the updated surface current coefficients. These column eliminations are supported by straightforward row eliminations, leading to increasingly sparse tree structures and matrix equations as iterations continue. We show that the proposed implementation, namely, trimmed MLFMA (T-MLFMA), leads to significantly accelerated electromagnetic simulations of the large-scale objects, while the accuracy is still much better than the high-frequency techniques. T-MLFMA can be seen as an exemplar of the implementations, where machine learning is successfully integrated into an electromagnetic solver for enhanced simulations.