At present, the urban traffic system is faced with the problems of congestion and low efficiency, and the traditional methods have certain limitations when dealing with the complex urban road network. This paper aims to explore a new method of capacity Optimization of Road Networks in a Smart City environment and proposes a method based on a Graph Neural network, named “Smart City Road optimization Graph Neural Network” (SCRO-GNN). SCRO-GNN first collects and preprocesses multi-source data, including road network data, traffic flow, accident records, environmental factors, etc. The key node and edge features, including the number of lanes at the intersection, the traffic flow of the section, and the adjacency matrix of the road network are defined to characterize the structure of the road network. Then, the graph neural network model is constructed and trained to predict the traffic flow of different sections and evaluate the road capacity by using the graph structure of the road network. This paper tests the performance of SCRO-GNN on real road networks in multiple cities. The results show that, compared with the traditional traffic flow prediction model, SCRO-GNN can significantly improve the prediction accuracy, especially when dealing with the highly complex urban road network structure. Based on these predictions, the proposed optimization strategy performed well in reducing traffic congestion and improving the efficiency of road use. The research in this paper not only demonstrates the potential of graph neural networks in smart city road network optimization, but also provides a new direction for future traffic system research. The successful implementation of the SCRO-GNN approach is expected to provide more efficient and intelligent solutions for urban traffic management and planning.