The notation here is confusing, because the same symbol $\hat{H}$ is used for two different things:
The operator $\hat{H}$ that you start with, i.e. the one you use in $\hat{H} |\psi(t) \rangle$, is the Hamiltonian as an abstract Hilbert space operator.
The operator $\hat{H}$ that appears in $\hat{H} \langle x | \psi(t) \rangle$ is the representation of the Hamiltonian in the position representation.
So it would be much cleaner to write something like:
$\hat{H}^{(pos.)} \langle x | \psi(t) \rangle = \langle x | \hat{H} | \psi(t) \rangle $
This last equation is actually a definition of operators in the position representation of the Hilbert space.
This can be easier understood by considering the momentum operator $\hat{p}$. In the abstract Hilbert space of kets, it is just an abstract operator given by $\hat{p} = \int \mathrm{d} p \ p |p \rangle \langle p | \ $.
Its representation in position space, i.e. $\hat{p}^{(pos.)} \langle x | \psi \rangle = \langle x | \hat{p} | \psi \rangle$, is the familiar: $ \ \hat{p}^{(pos.)} = - i \frac{\partial}{\partial x}$
In particular, it is a differential operator.
However, its representation in momentum space, i.e. $\hat{p}^{(mom.)} \langle p | \psi \rangle = \langle p | \hat{p} | \psi \rangle$
is given by $\hat{p}^{(mom.)} = p \ $. So in the momentum representation of the abstract Hilbert space, the momentum operator is represented by just a number. This is different from the differential operator we had in the position representation.
It is quite common in textbooks and papers to not have this explicit label $(mom.)$ or $(pos.)$, simply because people got used to representing the same physical operator in different ways.
To go sure, $\psi(x) = \langle x | \psi \rangle$ is the wavefunction associated with the state $|\psi \rangle$. The object $\widetilde{\psi}(p) := \langle p | \psi \rangle$ is the analogous object in momentum space.