In the frame of the traditional wavelet-Galerkin method based on the compactly supported wavelets, it is important to calculate the so-called connection coefficients that are some integrals whose integrands involve products of wavelets, their derivatives as well as some known coefficients in considered differential equations. However, even for linear differential equations with non-constant coefficient, the computation of connect coefficients becomes rather time-consuming and often even impossible. In this paper, we propose a generalized wavelet-Galerkin method based on the compactly supported wavelets, which is computationally very efficient even for differential equations with non-constant coefficients, no matter linear or nonlinear problems. Some related mathematical theorems are proved, based on which the basic ideas of the generalized wavelet-Galerkin method are described in details. In addition, some examples are used to illustrate its validity and high efficiency. A nonlinear example shows that the generalized wavelet-Galerkin method is not only valid to solve nonlinear problems, but also possesses the ability to find new solutions of multi-solution problems. This method can be widely applied to various types of both linear and nonlinear differential equations in science and engineering.