• A new urban-growth CA model using the firefly algorithm can enhance the simulation accuracy. • The model was applied to simulate the past and future urban patterns of Xi-xian. • The land transition probability indicates that the traffic facilities have a significant impact. • The FOM in the calibration and validation are respectively increased by 4.84% and 8.10%. • The model can improve CA-based simulation methods and enhance our understanding. Optimization of cellular automata (CA) using swarm intelligence is an effective approach to establish optimal models for urban growth modeling. This study builds a new CA model (CA FFA ) using the firefly algorithm through optimizing transition rules, aiming to enhance the simulation accuracy. We applied CA FFA to reproduce historical urban growth (2009-2014 and 2014-2019) and simulate future scenarios (2024 and 2029) of the Xi-xian metropolitan area in 2009, 2014 and 2019. The retrieved CA FFA parameters and land transition probability maps indicate that the traffic facilities have more significant impacts on urban growth in Xi-xian than the socio-economic and other proximity factors. The overall accuracy of CA FFA is 90.2% in 2014 and 94.6% in 2019, both better than the logistic CA model (88.9% and 92.2%). The figure-of-merits of CA FFA in calibration and validation are respectively increased by 4.84% and 8.10% compared with the logistic CA model. With the increasing distance to the city center, new urban areas will first increase and then decrease, and be mainly distributed in the northern part, which are consistent with the local development planning and have strong practical significance. The proposed model can improve CA-based modeling methods and enhance our understanding of Chinese western cities.