  We extend the theory of chiral and factorization algebras, developed for
curves by Beilinson and Drinfeld in \cite{bd}, to higher-dimensional varieties.
This extension entails the development of the homotopy theory of chiral and
factorization structures, in a sense analogous to Quillen's homotopy theory of
differential graded Lie algebras. We prove the equivalence of
higher-dimensional chiral and factorization algebras by embedding factorization
algebras into a larger category of chiral commutative coalgebras, then
realizing this interrelation as a chiral form of Koszul duality. We apply these
techniques to rederive some fundamental results of \cite{bd} on chiral
enveloping algebras of $\star$-Lie algebras.
