We construct differential geometry (connection, curvature, etc.) based on generalized derivations of an algebra [Formula: see text]. Such a derivation, introduced by Brešar in 1991, is given by a linear mapping [Formula: see text] such that there exists a usual derivation, d, of [Formula: see text] satisfying the generalized Leibniz rule u(ab) = u(a)b + ad(b) for all [Formula: see text]. The generalized geometry “is tested” in the case of the algebra of smooth functions on a manifold. We then apply this machinery to study generalized general relativity. We define the Einstein–Hilbert action and deduce from it Einstein’s field equations. We show that for a special class of metrics containing, besides the usual metric components, only one nonzero term, the action reduces to the O’Hanlon action that is the Brans–Dicke action with potential and with the parameter ω equal to zero. We also show that the generalized Einstein equations (with zero energy–stress tensor) are equivalent to those of the Kaluza–Klein theory satisfying a “modified cylinder condition” and having a noncompact extra dimension. This opens a possibility to consider Kaluza–Klein models with a noncompact extra dimension that remains invisible for a macroscopic observer. In our approach, this extra dimension is not an additional physical space–time dimension but appears because of the generalization of the derivation concept.