To achieve high-quality coordinated development of roadbed and environment in mountainous railways, a coupling optimization and regulation method of roadbed and environment was proposed. Firstly, the compatibility and symbiosis between the railway roadbed and the environment were defined, and a green element indicator system was constructed. The coupling regulation framework was clarified by combining the coupled Rubik’s cube game model. Secondly, the coupling coordination degree model, pressure bearing model, and functional relationships between key elements were used to jointly construct the objective function and constraint conditions for roadbed and environment regulation and optimization. The green key elements of roadbed engineering were taken as the main control variables, and an intelligent optimization algorithm, namely the chameleon swarm algorithm (CSA) was adopted to solve them, obtaining the optimal solutions of each main control variable in a compatible and symbiotic state. Finally, an empirical analysis was conducted by using the railway roadbed in a certain mountainous area as an example. The results show that when the main control variables of road cut excavation size, embankment filling size, support structure design, support structure layout, engineering protection structure design, slope engineering protection layout, plant protection structure design, slope plant protection layout, ecological sound barrier structure design, and ecological sound barrier layout are optimized by 36.83%, 43.14%, 49.93%, 68.91%, 69.98%, 68.91%, 23.42%, 68.91%, 19.64%, and 19.60%, respectively, the evolution of railway roadbed and environment from primary coordination state to intermediate coordination state can be achieved. The research results verify the rationality of the constructed roadbed and environment regulation and optimization model and the effectiveness of CSA in finding the optimal solution, providing a scientific basis for achieving green construction of railway roadbed engineering in mountainous areas.