Let $X,Y$ be two projective variety over an algebraically closed field, then we know $Hom(X,Y)$ has a scheme structure by considering the embedding as a open subscheme of $Hilb(X \times Y)$ using the graph.
We know for each fixed polynomial $P$, the Hilbert scheme with Hilbert polynomial $P$ is projective hence finite type. And it seems that the graph of any $f:X -> Y$ is isomorphic to $X$ hence has the same Hilbert polynomial viewed as a closed subscheme of $X \times Y$. However, Hom scheme can have infinitely many component (for example consider $End(E)$ where $E$ is an ellptic curve). So where does my intuition goes wrong? If $X,Y$ are both smooth curves, can we decide all of the connected components?