The clogging phenomenon finds extensive application in both industrial processes and daily life events. While this broad spectrum of application motivated extensive research to identify the general factors underlying the clogging mechanism, it results in a fragmented and system-specific understanding of the entire clogging process. Therefore, it is essential to establish a holistic understanding of all contributing factors of clogging based on the microscopic physical mechanisms. In this paper, we experimentally investigate clogging of granular materials in a two-dimensional hopper flow and present a self-consistent physical mechanism of clogging based on precursory chain structures. These chain structures follow a specific modified restricted random walk, and clogging occurs when they are mechanically stable enough to withstand the flow fluctuations. We introduce a single-particle model that can explain the arch-forming probability. Our results provide insight into the microscopic mechanism behind clogging and a broader understanding of the dynamics of dense granular flow.