Let $(A,\mathfrak{m})$ denote the local ring of $C$ at $P$, with uniformizing parameter $s\in\mathfrak{m}$. Let $f$ be a function on $C$, which is regular at $P$. Let $Spec(A')$ be an open affine neighborhood of $P$ which does not meet the locus which maps to $\infty$. Then, we can view $f$ in two ways:
(1) $f$ is an element of $A'$ and hence defines an element of $A$. By definition of $ord$, up to a unit in $A$, this element is $s^{ord_P(f)}$.
(2) $f$ is a function, $f:Spec(A')\rightarrow \mathbb{A}^1$. Equivalently, $f$ is a map $f^*:k[t]\rightarrow A'$. By definition, it is the map which sends $t$ to the regular function $f$ on $SpecA'$, i.e. $f^*t=f$ where the right hand side is in the sense of (1).
So it's confusing because $f^*t=f$ seems to make no sense. But when we say $f^*$ on the LHS, we're viewing $f$ as a map of varieties, and when we say $f$ on the RHS, we're viewing $f$ an element of the ring of regular functions at $P$.
Viewed another way, it's the only thing that could possibly make sense. Whenever you have a map to $f:X\rightarrow\mathbb{A}^1$, you get a regular function on $X$ by pulling back the regular function $t$ on $\mathbb{A}^1$. What else could that regular function be but $f$?
To elaborate on Angina Seng's comment. What you have run into here is just a typical abuse of notation, you've definitely done it before yourself!
We write "$m$" (which strictly speaking just an element of $\mathbb{Z}$) for an element of $\mathbb{Z}/n\mathbb{Z}$ when we really mean the coset $m + n\mathbb{Z}$. Similarly we write "$(P) - (O)$" (which again is just an element of $\operatorname{Div}^0(E)$) when we really mean the element $(P) - (O) + \operatorname{Princ}(E)$, its image in $\operatorname{Pic}^0(E)$.
In your comment you say that
Why is it than allowed to say that because of the bijection of $P \mapsto (P)−(O)$ the map $P \mapsto (P)−(O)+\operatorname{Princ}(E)$ is also a bijection?
The map
$$E \to \operatorname{Div}^0(E) : P \mapsto (P) - (O)$$
is not a bijection (since, for example, $2(P) - 2(O)$ does not get hit for any $P \neq O$). But we can show that the map
$$E \to \operatorname{Pic}^0(E) : P \mapsto (P) - (O)$$
is a bijection when again we are using the abuse of notation above (this is e.g., Silverman, The Arithmetic of Elliptic Curves, Prop 3.4).
A final tiny point, at this level of abstraction $O$ is your given $K$-point of $E$, it doesn't have to be the point at infinity - i.e., you don't need to choose a Weierstrass equation.
Best Answer
Not always. For instance, if $X$ is a conic with $X(k)=\varnothing$, the image of $\deg$ is $2\mathbb{Z}$.