Whilst an endomorphism is a morphism or homomorphism from a mathematical object to itself, the technical term for a function that has a domain equal to it's co-domain is called an endofunction.
NB: A homomorphic endofunction is an endomorphism.
Edit: From Wikipedia:
Let $S$ be an arbitrary set. Among endofunctions on $S$ one finds permutations of $S$ and constant functions associating to each $x \in S$ a given $c \in S$.
Every permutation of $S$ has the codomain equal to its domain and is bijective and invertible. A constant function on $S$, if $S$ has more than $1$ element, has a codomain that is a proper subset of its domain, is not bijective (and non invertible). The function associating to each natural integer $n$ the floor of $n/2$ has its co-domain equal to its domain and is not invertible.
Finite endofunctions are equivalent to directed pseudoforests. For sets of size $n$ there are $n^n$ endofunctions on the set.
Particular bijective endofunctions are the involutions, i.e. the functions coinciding with their inverses.