If I understand the question, what you are asking is how do we find a Hamiltonian which implements a given quantum gate (such as CNOT, Haddamard etc).
Well there are many Hamiltonian's you can find that will do the job. I'll start with the (easy) time independent case. Given an evolution under H implements U after some time and H has no time dependence, it must be true that eigenvectors of H are also eigenvectors of U. By basic counting arguments you should also be able to convince yourself that this works in the other direction as well (eigenvectors of U are the eigenvectors of H). Suppose I have an eigenvector of H which by definition satisfies $H|\lambda\rangle = \lambda |\lambda \rangle$. Then after some time evolution we would have $e^{ i\lambda t / 2 \pi}|\lambda\rangle$. This implies that $U|\lambda\rangle = e^{ i\lambda t / 2 \pi}|\lambda\rangle$. So the procedure to calculate H from U is to diagonalize U into $SDS^{-1}$ and then change all the elements in D over to their phase in the complex plane (divided by whatever evolution time you desire). Simple right.
Now the time dependent case is harder. There is no general, analytic solution. What we have is algorithms which given a few time dependent Hamiltonians $\{ H_0, H_1 ...\}$ will try to generate a sum $a_0 H_0 + a_1 H_1 ...$ which does the job. This is very useful for lab setups where you have access to a handful of time dependent Hamiltonians (eg laser pulses) and you want to find the appropiate combination. The algorithms for doing this are basically gradient decent on the parameter space $\{a_0, a_1 ...\}$. Examples off the top of my head include GOAT and CRAB.