Derivation of the nonequilibrium generalized Langevin equation from a time-dependent many-body Hamiltonian