Nowadays, optimal trajectory planning and trajectory tracking have become the main subject of numerous research projects, and have a wide range of applicability in planning missions for a lot of marine vehicle, such as unmanned submarines, buoyant vehicles, ships, landing crafts, etc. This paper investigates the problem of path planning of a submarine, with simultaneous utilization of the direct collocation method and Pontryagin's Minimum Principle, intending to minimize its detection probability. Moreover, tracking of the path obtained from the direct collocation method is provided through model predictive control, with the two-dimensional motion relations of the submarine as predicting model comparison of the results obtained from implementing these two methods reveals that the cost associated with the direct collocation method almost closely matches the one corresponding to the indirect method. There is a negligible difference between the costs which, in fact, is due to the utilization of a numerical solution procedure in the former and an analytical one in the latter. Nevertheless, when it comes to the duration of solution iterations, the collocation method is faster, and as a result, despite the other approach, practicable enough to be able to solve complex problems. Furthermore, the results confirm the capability of the model predictive control for real-time path tracking.