You're right that these are not literally equal - they don't live in the same place, so they can't be equal as sets. But they are both correct, and they are morally the same construction seen from different perspectives: the first construction is the answer to "what is the vanishing set of an ideal" from a more schemey viewpoint, like the third or fourth definition at What is an algebraic variety? while the second construction is the answer from a more variety-theoretic viewpoint, like the first two definitions at that link.
To see how they compare, consider the map $\varphi:K^n \to \operatorname{Spec} K[x_1,\cdots,x_n]$ by $(k_1,\cdots,k_n) \mapsto (x_1-k_1,\cdots,x_n-k_n)$. For a fixed ideal $I\subset R$, I claim that $(k_1,\cdots,x_n)\in V(I)\subset K^n$ (with $V(I)$ used in the second sense) iff $(x_1-k_1,\cdots,x_n-k_n)\in V(I)\subset\operatorname{Spec} R$ (with $V(I)$ used in the first sense). Indeed, $f(k_1,\cdots,k_n)=0$ for a polynomial $f$ iff $f\in (x_1-k_1,\cdots,x_n-k_n)$: by induction on the degree of $f$, we can show that there is a polynomial $p$ such that $$f(x_1,\cdots,x_n) = p(x_1-k_1,\cdots,x_n-k_n) + f(k_1,\cdots,k_n),$$ and the RHS is in $(x_1-k_1,\cdots,x_n-k_n)$ iff $f(k_1,\cdots,k_n) = 0$. So every element of $I$ evaluates to $0$ on $(k_1,\cdots,k_n)$ iff every element of $I$ is in $(x_1-k_1,\cdots,x_n-k_n)$, and we've proven the claim.
Under the identification of $K^n$ with a subset of $\operatorname{Spec} K[x_1,\cdots,x_n]$, we have that $V(I)\subset K^n$ is naturally a subset of $V(I)\subset\operatorname{Spec} R$. But there are many places where this inclusion after identification is proper:
- if $K$ is not algebraically closed, there can be other points in $V(I)\subset\operatorname{Spec} R$, like if $K=\Bbb R$ and $I=(x_1^2+x_2^2)$, the prime ideal $(x_1^2+1,x_2-1)$ is in $V(I)\subset\operatorname{Spec} R$ but not in the image of $\varphi$,
- if $V(I)$ is positive-dimensional, there are other points in $V(I)\subset\operatorname{Spec} R$, such as if $n=3$ and $I=(x_1)$, then the prime ideal $(x_1,x_2)$ is in $V(I)$ but it is not in the image of $\varphi$ because it is not maximal.
So even after identification, the second definition (usually) only gets you a subset of the first definition. But the extra stuff we pick up is quite useful - being able to do algebraic geometry in a more intrinsic way over a non-algebraically-closed field (or even a general ring) as in the first bullet, and being able to keep track of generic points as in the second bullet are both big advances that make a lot of further algebraic geometry possible.