The application of smart grids and other systems generates a large amount of data, which is of great value to the research in electric power. This paper analyzes and mines the electric power data in a smart grid through data mining technology to provide technical and data support for analyzing users’ electricity consumption behavior, grid load prediction, and power dispatch optimization. The user electricity feature selection algorithm is built using the mRMR criterion, and it is combined with the improved fuzzy C-mean algorithm to categorize and analyze the user’s electricity consumption behavior. The LSTM algorithm is used in this paper to forecast power load in the smart grid due to the ability of long and short-term memory networks to handle long-term dependencies. The objectives for optimizing the power system scheduling, such as minimizing pollution emissions, are selected, and the optimal solution is calculated using a genetic algorithm. The feature selection algorithm evaluates the user’s electricity consumption characteristics, combines the clustering algorithm to compare the internal metrics of the two feature selections, and classifies the user’s electricity consumption behavior into six categories according to the electricity consumption characteristics. The accuracy of the LSTM algorithm’s prediction of the grid load reaches 74.19% on the validation set, and the mean square error is 0.881. In the final optimal solution obtained for power dispatch optimization, the pollution emission is only 8.93 kgCO2/H, and customer satisfaction can reach 74.89%.