The recent availability of digital traces from Information and Communications Technologies (ICT) has facilitated the study of both individual- and population-level movement with unprecedented spatiotemporal resolution, enabling us to better understand a plethora of socioeconomic processes such as urbanization, transportation, impact on the environment and epidemic spreading to name a few. Using empirical spatiotemporal trends, several mobility models have been proposed to explain the observed regularities in human movement. With the advent of the World Wide Web, a new type of virtual mobility has emerged that has begun to supplant many traditional facets of human activity. Here we conduct a systematic analysis of physical and virtual movement, uncovering both similarities and differences in their statistical patterns. The differences manifest themselves primarily in the temporal regime, as a signature of the spatial and economic constraints inherent in physical movement, features that are predominantly absent in the virtual space. We demonstrate that once one moves to the time-independent space of events, i.e the sequences of visited locations, these differences vanish, and the statistical patterns of physical and virtual mobility are identical. The observed similarity in navigating these markedly different domains point towards a common mechanism governing the movement patterns, a feature we describe through a Metropolis-Hastings type optimization model, where individuals navigate locations through decision-making processes resembling a cost-benefit analysis of the utility of locations. In contrast to existing phenomenological models of mobility, we show that our model can reproduce the commonalities in the empirically observed statistics with minimal input.