In this paper we develope, in a geometric framework, a Hamilton-Jacobi Theory for general dynamical systems. Such a theory contains the classical theory for Hamiltonian systems on a cotangent bundle and recent developments in the framework of general symplectic, Poisson and almost-Poisson manifolds (including some approaches to a Hamilton-Jacobi theory for nonholonomic systems). Given a dynamical system, we show that every complete solution of its related Hamilton-Jacobi Equation (HJE) gives rise to a set of first integrals, and vice versa. From that, and in the context of symplectic and Poisson manifolds, a deep connection between the HJE and the (non)commutative integrability notion, and consequently the integrability by quadratures, is stablished. Moreover, in the same context, we find conditions on the complete solutions of the HJE that also ensures integrability by quadratures, but they are weaker than those related to the (non)commutative integrability. Examples are developed along all the paper in order to illustrate the theoretical results.