In mobile edge computing (MEC), quality of service (QoS) is closely related to optimizing service placement strategies, which is crucial to providing efficient services that meet user needs. However, due to the mobility of users and the energy consumption limit of edge servers, the existing policies make it difficult to ensure the QoS level of users. In this paper, a novel genetic algorithm based on a simulated annealing algorithm is proposed to balance the QoS of users and the energy consumption of edge servers. Finally, the effectiveness of the algorithm is verified by experiments. The results show that the QoS value obtained by the proposed algorithm is closer to the maximum value, which has significant advantages in improving QoS value and resource utilization. In addition, in software development related to mobile edge computing, our algorithm helps improve the program’s running speed.