With the increasing size and frequency of mass events, the study of crowd disasters and the simulation of pedestrian flows have become important research areas. However, even successful modeling approaches such as those inspired by Newtonian force models are still not fully consistent with empirical observations and are sometimes hard to calibrate. Here, a cognitive science approach is proposed, which is based on behavioral heuristics. We suggest that, guided by visual information, namely the distance of obstructions in candidate lines of sight, pedestrians apply two simple cognitive procedures to adapt their walking speeds and directions. Although simpler than previous approaches, this model predicts individual trajectories and collective patterns of motion in good quantitative agreement with a large variety of empirical and experimental data. This model predicts the emergence of self-organization phenomena, such as the spontaneous formation of unidirectional lanes or stop-and-go waves. Moreover, the combination of pedestrian heuristics with body collisions generates crowd turbulence at extreme densities--a phenomenon that has been observed during recent crowd disasters. By proposing an integrated treatment of simultaneous interactions between multiple individuals, our approach overcomes limitations of current physics-inspired pair interaction models. Understanding crowd dynamics through cognitive heuristics is therefore not only crucial for a better preparation of safe mass events. It also clears the way for a more realistic modeling of collective social behaviors, in particular of human crowds and biological swarms. Furthermore, our behavioral heuristics may serve to improve the navigation of autonomous robots.