Situation awareness (SA) of pilots’ unsafe behavior can ensure safety onboard. Thus, the cognitive mechanism that controls the SA leading to unsafe behavior must be articulated. This study employs the SA model and theory of planned behavior (TPB) to articulate a quantitative model of ship safe piloting. Firstly, the hierarchical classification framework of unsafe behaviors was constructed as an analytical foundation for rational and unconscious behaviors in sight of cognitive processes, and then the measurement elements of the cognitive mechanisms for behaviors were identified. Subsequently, based on the structural model, a hypothetical model of the cognitive path for unsafe behaviors was proposed by using the extended TPB, where there are four independent variables (i.e., attitude (ATD), subjective norm (SN), and perceived behavioral control (PBC)), one mediating variables (i.e., SA) and two dependent variables (i.e., behavioral intention (BI) and unsafe behaviors (BE)). Finally, this hypothetical model was analyzed with the data resources from extended TPB questionnaire of 295 pilots. Analysis results show that relationships of causation and mediation in the cognitive mechanism are in line with the behavior pattern and SA have a pronounced mediating effect and a strong relevance to the causal chain of extended TPB framework. This study integrated the SA three-level model to understand the motivation–cognition–action–feedback (MCAF) mechanism of pilots’ unsafe behaviors under cognitive mode of information processing through structural model. It would make a valuable contribution to the assessment and intervention of safety behaviors, and provide a basic framework for monitoring the situation awareness of pilot by man-machine interactive measurement technology in the future.