Our aim is to study the backward problem, i.e. recover the initial data from the terminal observation, of the subdiffusion with time dependent coefficients. First of all, by using the smoothing property of solution operators and a perturbation argument of freezing the diffusion coefficients, we show a stability estimate in Sobolev spaces, under some smallness/largeness condition on the terminal time. Moreover, in case of noisy observation, we apply a quasi-boundary value method to regularize the problem and then show the convergence of the regularization scheme. Finally, to numerically reconstruct the initial data, we propose a completely discrete scheme by applying the finite element method in space and backward Euler convolution quadrature in time. An a priori error estimate is then established. The proof is heavily built on a perturbation argument dealing with time dependent coefficients and some nonstandard error estimates for the direct problem. The error estimate gives a useful guide for balancing discretization parameters, regularization parameter and noise level. Some numerical experiments are presented to illustrate our theoretical results.