Investigated is a variant of the Wess-Zumino-Witten model called a twisted WZW model, which is associated to a certain Lie group bundle on a family of elliptic curves. The Lie group bundle is a non-trivial bundle with flat connection and related to the classical elliptic r-matrix. (The usual (non-twisted) WZW model is associated to a trivial group bundle with trivial connection on a family of compact Riemann surfaces and a family of its principal bundles.) The twisted WZW model on a fixed elliptic curve at the critical level describes the XYZ Gaudin model. The elliptic Knizhnik-Zamolodchikov equations associated to the classical elliptic r-matrix appear as flat connections on the sheaves of conformal blocks in the twisted WZW model.