Function and graph A relation is a subset of a carthesian product.
A function from $X$ to $Y$ is a relation with particular properties. It follows that a function is a subset of the cartesian product $X\times Y$.
The graph of f is
$$ 
\{(x,y) \in  X\times Y\ |\  y=f(x)\}.
$$
Then what is the difference between the graph and the function if both are the same subset of $X\times Y$?
 A: A function consists of three things: The domain, the codomain and a mapping between those two.
The graph of a function is a formal representation of the mapping. But it doesn't tell you what the function's codomain is. Furthermore, if you allow your function to be a partial function, the graph of the function doesn't tell you what the domain looks like.
So, when you describe a function in a set-theoretical way, think of it as a triple, consisting of domain, codomain and graph.
A: I'm with Terence Tao when he writes

functions are not sets, and sets are not functions; it does not make
sense to ask whether an object $x$ is an element of a function $f$,
and it does not make sense to apply a set $A$ to an input $x$ to
create an output $A(x)$.

Taking it slowly, note first that even if, for certain purposes, we implement a function as a set of ordered pairs, it is arbitrary (i) to  fix on e.g. Kuratowski's particular implementation of pairs as sets (there other perfectly workable options).  And even relative to a choice of set-theoretic pairing scheme, (ii) we could equally well implement a function using the set of pairs $\langle y, x\rangle$ where $f(x) = y$, rather than by the set of pairs $\langle x, y\rangle$ -- some textbooks do just this. (Again, other choices are also possible.)
However, if various permutations of choices at stages (i) and (ii) are pretty much as workable as each other, then we surely can't suppose that -- when we choose to implement a function as its graph as conventionally defined  -- we have made the uniquely right choice, i.e. the choice that correctly identifies which set that function really is.
But if there is no determinate fact of the matter about which sets functions are, then functions aren't sets.
It is worth digging a bit deeper. The key underlying point is that functions just aren't the right logical type of thing to be sets. As  the great logician Alonzo Church puts it:

it lies in the nature of any given [one-place] function to be
applicable to certain things and, when applied to one of them as
argument, to yield a certain value.

For example, a function such as the factorial defined over the natural numbers is, of its nature, the type of thing which yields a numerical value when given a number as argument. By contrast a set doesn't, of its nature, take an argument or yield a value, as Tao is pointing out; and what applies to sets in general applies to e.g. sets of ordered pairs of numbers in particular. (A well-known Fregean metaphor might help. Functions of their nature are 'unsaturated', having a number of empty slots waiting to be filled appropriately when the function is applied to the right number of arguments. By contrast, a set is already 'saturated', it is self-standing, with no empty slots waiting to be filled.)
Which isn't for a moment to deny that we can make use of the graph $\hat{f}$ (a glorified input-output look-up table) for the function $f$ in mapping an input object to an output value. But to do this, we need to deploy another function, namely a two-place evaluation function which takes an object $x$ and the graph $\hat{f}$, and outputs $y$ if and only if the pair $\langle x, y\rangle$ is in the graph. And unless we are planning to set off on an infinite regress, we had better not seek to  again trade in this evaluation function for another set.
So yes, for many purposes, appropriate sets (graphs) can be used as proxies for functions ('implement' functions, if you prefer). But that doesn't make functions sets. 'Everything is what it is and not another thing'.
