In a sense, this is very easy to do: my function is simply $f(x)=y$, where for each $x$ I find the intersection of the vertical line at $x$ with my curve, which by the vertical line test is uniquely defined. In the modern perspective on functions, this is fine: a function $f:\mathbb{R}\to\mathbb{R}$ is just any list of pairs $(x,f(x))$.
But it seems likely this isn't the kind of thing you were thinking: perhaps for you a function means something with a nice formula? This was more or less the perspective of mathematicians through the end of the 18th century, so you're in good company. In general here the answer is, no, not every curve has a formula in terms of (say) compositions, sums and products of polynomials, exponentials, logarithms, and trigonometric functions.
When it comes to computing a formula with a computer, though, we can get very close. The relevant result is that
For any continuous function $f:[a,b]\to\mathbb{R}$ on a bounded interval, there's a polynomial $p$ on $[a,b]$ such that $|p-f|$ is as small as you wish.
Why continuous? Well, if it's a curve you can actually draw, it will be continuous at least in pieces, so this is no real restriction. And neither is the limitation to the bounded interval: I don't know about you, but I don't have infinitely much time for drawing curves in the whole plane.
Given those restrictions, it's actually rather simple to get a formula approximating your function very closely: you compute finitely many points on the curve, say, even by measuring the paper, and find a polynomial going through those points-for instance, by the technique of Lagrange interpolation.
The discussion in more dimensions is essentially identical.