Can two morphisms with equal mappings be distinct in category theory?

Recall that part of the definition of a category is that for any two objects $A$ and $B$, the category specifies a set (or class, if your categories are not required to be locally small) $\operatorname{Mor}_C(A,B)$ of morphisms from $A$ to $B$. When we write $f:A\to B$, that is just an alternate notation for saying that $f\in\operatorname{Mor}_C(A,B)$. So if $f:A\to B$ and $g:A\to B$, do $f$ and $g$ have to be equal? Certainly not, because $\operatorname{Mor}_C(A,B)$ is just some set, and $f$ and $g$ might be different elements of that set.

In other words, writing $f:A\to B$ does not specify exactly what $f$ is in the same way that writing $x=5$ specifies exactly what $x$ is. All it says is that $f$ is some element of the set $\operatorname{Mor}_C(A,B)$, but it doesn't say which one. This is analogous to stating something like "$x$ is a real number"--this tells you some information about $x$, but does not uniquely determine it. If you say something like "let $x$ and $y$ be real numbers", then $x$ and $y$ might be equal, or they might not--you simply haven't said whether they are or not. Similarly, if you say "let $f:A\to B$ and $g:A\to B$", this says nothing about whether $f$ and $g$ are equal.

For a really simple example, consider the category $C=\mathtt{Set}$ of sets, in which objects are sets and morphisms are functions between sets. If you have two sets $A$ and $B$, are any two functions $A\to B$ the same? Certainly not in general. For instance, if $A=B=\mathbb{R}$, you might have one function $f:\mathbb{R}\to\mathbb{R}$ defined by $f(x)=x$ and another function $g:\mathbb{R}\to\mathbb{R}$ defined by $g(x)=x^2$.


There are various ways to address your question.

From a naive point of view, it is equivalent to: "someone gave me a set. Does the set have more than two elements?" The answer is: sometimes yes, but oftentimes it can be very difficult to know it does.

More explicitly: in the axioms of a category, there is one that says more or less

for evey two objects $X,Y$ of $\cal C$ there is a set $\hom(X,Y)$ such that...

Sets have elements; $f : A\to B$ is just another way to say that $f \in \hom(X,Y)$. Now, if $f,g \in \hom(X,Y)$ it is perfectly legitimate to ask if $f=g$ (and depending on your foundation of reference the question can have several different flavours). The answer may vary; let $\mathcal C$ be the category $$ 0 \overset{u}\to 1\underset{g}{\overset{f}\rightrightarrows} 2 $$ defined by setting $fu=gu$ and $f=g$ if and only if the Riemann hypothesis is true (or an equally mainstream open problem in hard mathematics).

Of course, some mathematicians may reject this "definition" as a figment; the point is that at least in its naive definition, a category knows how to distinguish its parallel morphisms at least as much as set theory knows how to distinguish elements of a conglomerate.

A different point of view is that of enriched category theory: an enriched category is not a collection of objects and sets of arrows, but instead it is a collection of objects and other objects ${\cal C}(X,Y)\in \cal V$ of a monoidal category such that composition and identities... yadda yadda, you can read the definition on WikiPedia or on the $n$Lab.

Now being an arrow $f :X \to Y$ oftentimes means that $f$ can be thought as the element of a set. But this results in a loss of information, and it is not considered a good practice when doing enriched CT.

In this setting, an enriched category knows how to distinguish its parallel morphisms at least as much as the category $\cal V$ where its hom-objects live... well, now you see the problem: a set has elements. An object of $\cal V$ does not, and in general it doesn't consist of the sum of irreducible parts.