The question is in the title, but allow me to provide some background.
I’m aware that Leibniz introduced the word “function” into mathematics (around 1673) and that Johann Bernoulli or Euler introduced the notation $f(x)$ (sometimes between 1706-1740). I've also read the Wikipedia article on the History of the function concept and the book Die Analysis im Wandel und im Widerstreit by Spalt, plus a few other sources on the history of functions. But I haven't found the following addressed:
Looking at definitions* and uses of the word function among mathematicians up until the beginning of the 20th century, I see that they consistently call $y$ the function. By $y$ I mean the one in $y=f(x)$. Equivalently they call $f(x)$ the function. Actually they call $y$ a function of $x$, but they eventually drop the “of $x$” when it is clear from the context or irrelevant for the discussion. None of them ever consider $f$ as a mathematical object in itself.
This is in stark contrast to the modern definition, which calls $f$ the function, describes it as a rule or the like, and officially calls $f(x)$ something else (like the output of the function at input $x$ etc.).
The first mathematician I could find to distinguish clearly between $f$ and $f(x)$, with a definition similar to modern ones, was Cantor in 1895. But to my surprise he did not call $f$ a function but a “Belegung” (allocation). Here's my translation of what he wrote in Beiträge zur Begründung der transfiniten Mengenlehre, I, 1895, p.486:
By an ,allocation of the set $N$ with elements of the set $M$' or simply put, by an ,allocation of $N$ with $M$' we understand a law, through which with every element $n$ of $N$ is connected a certain element of $M$, where one and the same element of $M$ may be used repeatedly.
The with $n$ connected element of $M$ is to a certain extent a unique function of $n$ and may be denoted with $f(n)$; it shall be called the ,allocation function of $n$'; the corresponding allocation of $N$ shall be called $f(N)$.
Two allocations $f_{1}(N)$ und $f_{2}(N)$ are called equal if and only if, for all elements $n$ of $N$ the equation $$ f_{1}(n) = f_{2}(n),$$ holds, so that if for a single fixed element $n=n_{0}$ the equation does not hold, $f_{1}(N)$ and $f_{2}(N)$ are characterised as different allocations of $N$.
[$\ldots$]
The totality of all different allocations of $N$ with $M$ determines a set with the elements $f(N)$; we call it the ,set of allocations of $N$ with $M$' and denote it with $(N\mid M)$. Hence: $$ (N\mid M)=\{ f(N) \}. $$
Notice that he keeps the traditional meaning of the word function, so it makes perfect sense to give $f$ (or as he writes $f(N)$) a new name.
Two questions:
- Was Cantor the first person to treat $f$ as an object on its own and distinguish it from $f(x)$? In other words, was Cantor the first one to give the modern definition of a function?
- When and why did it become standard to call $f$ a function, despite the established use of the word for $f(x)$ (and despite Cantor calling $f$ something else)?
* Several such historical definitions can be found at the end of the following MO question: Formalizations of the idea that something is a function of something else?.