The usage rate of electric vehicles (EVs) is gradually increasing. Recharging of EVs should be carried out repeatedly over time, and the energy needed for this is high and increasing. With the present infrastructure, we cannot supply the required energy, and therefore, we need to implement a model that expands the power grid to satisfy our energy requirements. This paper proposes a convolutional neural network-based dynamic capacity expansion (CNN-DCE) for EV charging. Flower pollination optimization algorithm (FPOA) was used to improve the hyperparameters of CNN during training. The main aim is to reduce the cost of installing additional capacity resources and to reduce the operational cost. To cope with the load growth, different capacity resources are installed at different years of the planning boundary. Five statistical indices, such as mean squared error, mean absolute error, correlation coefficient, and scatter index, are used to evaluate the performance of CNN. The capacity expansion plan in the microgrid is achieved by expanding the energy of battery energy storage systems, microturbines, and solar and wind energy systems. The queuing delay for the EVs waiting in a queue for recharging has been considered. The performance of the proposed CNN-DCE is studied and compared with three other state-of-the-art methods. The results show that the resources reduce the planning cost to 26% for the short-term planning horizon, the long-term plan has 150% of the expansion, and the wind energy system covers 48% of the expansion cost.