The curved βγ system is a nonlinear σ-model with a Riemann surface as the source and a complex manifold X as the target. Its classical solutions pick out the holomorphic maps from the Riemann surface into X. Physical arguments identify its algebra of operators with a vertex algebra known as the chiral differential operators (CDO) of X. We verify these claims mathematically by constructing and quantizing rigorously this system using machinery developed by Kevin Costello and the second author, which combine renormalization, the Batalin-Vilkovisky formalism, and factorization algebras. Furthermore, we find that the factorization algebra of quantum observables of the curved βγ system encodes the sheaf of chiral differential operators. In this sense our approach provides deformation quantization for vertex algebras. As in many approaches to deformation quantization, a key role is played by Gelfand-Kazhdan formal geometry. We begin by constructing a quantization of the βγ system with an n\yh-dimensional formal disk as the target. There is an obstruction to quantizing equivariantly with respect to the action of formal vector fields Wn on the target disk, and it is naturally identified with the first Pontryagin class in Gelfand-Fuks cohomology. Any trivialization of the obstruction cocycle thus yields an equivariant quantization with respect to an extension of Wn by Ω^2cl, the closed 2-forms on the disk. By machinery mentioned above, we then naturally obtain a factorization algebra of quantum observables, which has an associated vertex algebra easily identified with the formal βγ vertex algebra. Next, we introduce a version of Gelfand-Kazhdan formal geometry suitable for factorization algebras, and we verify that for a complex manifold X with trivialized first Pontryagin class, the associated factorization algebra recovers the vertex algebra of CDOs of X.