Chronic imaging experiments in mice have revealed that the hippocampal code drifts over long time scales. Specifically, the subset of cells which are active on any given session in a familiar environment changes over the course of days and weeks. While some cells transition into or out of the code after a few sessions, others are stable over the entire experiment. Similar representational drift has also been observed in other cortical areas, raising the possibility of a common underlying mechanism, which, however, remains unknown. Here we show, through quantitative fitting of a network model to experimental data, that the statistics of representational drift in CA1 pyramidal cells are consistent with ongoing synaptic turnover in the main excitatory inputs to a neuronal circuit operating in the balanced regime. We find two distinct time-scales of drift: a fast shift in overall excitability with characteristic time-scale of two days, and a slower drift in spatially modulated input on the order of about one month. The observed heterogeneity in single-cell properties, including long-term stability, are explained by variability arising from random changes in the number of active inputs to cells from one session to the next. We furthermore show that these changes are, in turn, consistent with an ongoing process of learning via a Hebbian plasticity rule. We conclude that representational drift is the hallmark of a memory system which continually encodes new information.