Deep-sea exploring and sampling technologies have become frontier topics. Generally, the movable exploring mode near the seabed with low disturbance is an important way to improve the measurement accuracy and expand the measurement range. Inspired by fish, the fishlike propulsion method has the characteristics of low disturbance and high flexibility, which is very suitable for near-seabed detection under complex terrain conditions. However, the swimming mechanism and surrounding flow field evolution law of the robotic fish under the constraints of complex terrain are still unclear. In this paper, the confined terrain space is constructed with an undulating seabed and a narrow channel, and the hydrodynamic changing law and flow field evolution law of the autonomous swimming process of the fishlike swimmer in the confined space are analyzed. Moreover, the influence mechanism of the terrain on the motion performance of the robotic fish is revealed, and the optimal motion mode of the robotic fish under a complex terrain constraint is discussed. The results show that the propulsion force, Froude efficiency, and swimming stability of the robotic fish vary with the distance from the bottom under the undulating seabed condition lightly. When the distance from the bottom exceeds a certain value, it can be considered that the undulating seabed no longer affects the swimmer. Furthermore, when the robotic fish swims through a narrow channel with certain width, the swimming performance obviously varies with the distance from the boundary surface. During swimming in the confined terrain space, the propulsion force and swimming stability of robotic fish will decrease. In order to maintain the forward speed, the robotic fish should improve the tail-beat frequency in real time. However, considering the swimming stability, the tail-beat frequency is not the larger the better. The relevant conclusions of this paper could provide theoretical support for the development of low-disturbance bionic exploring and sampling platforms for deep-sea resources and environments.