Poor layout designs in manufacturing facilities severely reduce production efficiency and increase short- and long-term costs. Analyzing and deriving efficient layouts for novel line designs or improvements to existing lines considering both the layout design and logistics flow is crucial. In this study, we performed production simulation in the design phase for factory layout optimization and used reinforcement learning to derive the optimal factory layout. To facilitate factory-wide layout design, we considered the facility layout, logistics movement paths, and the use of automated guided vehicles (AGVs). The reinforcement-learning process for optimizing each component of the layout was implemented in a multilayer manner, and the optimization results were applied to the design production simulation for verification. Moreover, a flexible simulation system was developed. Users can efficiently review and execute alternative scenarios by considering both facility and logistics layouts in the workspace. By emphasizing the redesign and reuse of the simulation model, we achieved layout optimization through an automated process and propose a flexible simulation system that can adapt to various environments through a multilayered modular approach. By adjusting weights and considering various conditions, throughput increased by 0.3%, logistics movement distance was reduced by 3.8%, and the number of AGVs required was reduced by 11%.