The changes of the seabed environment caused by a natural disaster or human activities dramatically affect the life span of the subsea buried cable. It is essential to track the cable route in order to inspect the condition of the buried cable and protect its surviving seabed environment. The magnetic sensor is instrumental in guiding the remotely-operated vehicle (ROV) to track and inspect the buried cable underseas. In this paper, a novel framework integrating the underwater cable localization method with the magnetic guidance and control algorithm is proposed, in order to enable the automatic cable tracking by a three-degrees-of-freedom (3-DOF) under-actuated autonomous underwater vehicle (AUV) without human beings in the loop. The work relies on the passive magnetic sensing method to localize the subsea cable by using two tri-axial magnetometers, and a new analytic formulation is presented to compute the heading deviation, horizontal offset and buried depth of the cable. With the magnetic localization, the cable tracking and inspection mission is elaborately constructed as a straight-line path following control problem in the horizontal plane. A dedicated magnetic line-of-sight (LOS) guidance is built based on the relative geometric relationship between the vehicle and the cable, and the feedback linearizing technique is adopted to design a simplified cable tracking controller considering the side-slip effects, such that the under-actuated vehicle is able to move towards the subsea cable and then inspect its buried environment, which further guides the environmental protection of the cable by setting prohibited fishing/anchoring zones and increasing the buried depth. Finally, numerical simulation results show the effectiveness of the proposed magnetic guidance and control algorithm on the envisioned subsea cable tracking and the potential protection of the seabed environment along the cable route.