Mobile edge computing (MEC) plays a central role in smart-city construction by strengthening the computing capability of wireless devices and supporting responsive urban services. This study integrates an intelligent reflecting surface (IRS)–assisted channel model—an important 5G technology—into MEC system design and formulates an optimization framework aligned with smart-city performance requirements. An alternating-iteration strategy is used to decompose the overall problem into manageable subproblems, which are then solved using particle swarm optimization to build a performance-optimized 5G-based MEC system. Experimental results show that for a 10 Mbit computing task, the proposed system (M = 2) reduces latency by about 63.81%, lowering delay to 2.148 s compared with 5.935 s under a local-computing-only baseline, while maintaining good convergence behavior. The results also indicate that the resulting application platform can preserve fairness among multiple users and meet heterogeneous performance demands. Overall, the proposed MEC optimization approach delivers low-latency performance that supports efficient smart-city services, strengthens urban management capability, and contributes to improved service quality.