At recent days, the robot performs many tasks on behalf of humans or in support of humans. Among the most prominent benefits of robots for humans are removing the risk factor from humans, completing routine tasks for humans, saving a lot of time and effort, and mastering work. This paper presents a model of an eight-legged robot equipped with an intelligent controller that was simulated using MATLAB. The designed structure contains 24 controllers, three for each leg, to provide flexibility in movement and rotation. Proportional Integral Derivative (PID) controller has been used in this work , each leg contains three PIDs. A particle swarm optimization algorithm (PSO) was used to adjust the parameters of the PID controller (Kp , Ki and Kd). The structure of eight legs robot with controller is implemented using Simscape Multibody in the MATLAB program, where the movement of the eight-legged robot is visualized and analyzed without the need for complex analysis associated with a mathematical model. The simulation results were conducted in a three-dimensional environment and were presented in two scenarios . The first was implementing and simulating the robot without using a controller, which leads to the robot falling at the starting point. The second was when a PID controllers are used with the system, where better movement was obtained. Finally, the robustness of the controller was verified by changing the load that the robot bears.