As many of the commenters have pointed out, it is oftentimes useful to have a set of objects in mind that the function potentially maps to, even though the function does not map to all of those obejcts, i.e. The function is not surjective (or, what is the same thing, onto).
But what I don't understand, is that why we don't typically do the same thing on the input side: for many of the same reasons that I can see (e.g it may be hard to determine what inputs the functions is actually defined for), I would think it would be just as useful to have a set of objects in mind that the function potentially maps from, even though the function does not map all of those objects. Now, as it so happens, mathematicians do have terminology for this: a function that is not defined for all these potential inputs is known as a partial function, while a function that is defined for all of its potential input values is knows as a total function. But, typically, functions are supposed to be total ... Indeed, according to many texts, a partial function is by definition simply impossible. Again, I don't understand this practice. It is not symmetrical from how we treat things on the output side, and like I said, I would think many of the reasons for having a 'co-domain' that can be larger than the actual 'range' of a function can be applied on the input side as well.
In fact, I would think that whenever we define a function, one would have to indicate such a potential set of inputs in the first place. For example, if I define a function $f(x) = x^2$, then shouldn't I have to indicate what set the $x$ values come from? Is it the natural number, the real number, the complex numbers, ... or what? Now, we have a handy dandy notation of the form $f:A \rightarrow B$ ... So why not use that notation to define the potential input and output values? But no, no such luck: $A$ is supposed to be the domain, by which it is understood the set of values for which the function is actually defined, not potentially. Indeed, a function like $f(x) = 1/x$ is supposed to written $f:R/{0} \rightarrow R$ (or is it $f:R/{0} \rightarrow R/{0}$?! ... All assuming I intended this to be about the real numbers in thefirst place ...), all because functions have to be total.
Again, I find all of this highly unfortunate. I would say: the function $f:R \rightarrow R$ as defined by $f(x) = 1/x$ is a partial surjective function whose domain and codomain of discourse is $R$ and whose domain and codomain of definition is $R/{0}$. Wouldn't that be a lot easier and symmetrical? In fact, I bet if we were to follow this convention, far fewer high school student would be confused about 'domain', 'codomain' and 'range'.
And one more thing: I assume 'co-domain' is short for 'converse domain' and as Russell and Whitehead defined it, the converse domain is the domain of the converse (better known as inverse) of a function or relation (assuming the function is injective of course). OK, that is all nicely logically defined (as one would expect from a book called Principia Mathematica!) but now look at what a mess we have made of this in the modern usage of 'domain' and 'co-domain': the function $f(x)=1/x$ has as domain $R/{0}$, and as co-domain $R$. But the domain of its inverse/converse is $R/{0}$ (and don't ask me what its co-domain is supposed to be...) That is, the 'co-domain' is not the domain of its converse! Russell and Whitehead must be rolling in their graves!