The codimension of $X=Z(f_1,\ldots,f_k)$ in $\mathbf{A}^n$ equals $k$, or equivalently, the dimension of $X$ is $n-k$, if $(f_1,\ldots,f_k)$ is a regular sequence.
Let me explain what a regular sequence is. Sorry if I'm writing things you already know.
Let $A$ be a noetherian ring. An element $x\in A$ is called regular if the multiplication by $x$ is injective. A sequence $(x_1,\ldots,x_n)$ of elements $x_1,\ldots,x_n\in A$ is said to be a regular sequence if $x_1$ is regular and the image of $x_i$ in $A/(x_1A+\ldots+ x_{i-1}A)$ is regular for all $i=2,\ldots,n$.
You can use Krull's principal ideal theorem to show that any ideal $I$ of $A$ which can be generated by a regular sequence $(x_1,\ldots,x_r)$ satisfies $\textrm{ht}( I) = r$.
So one way to find out if the dimension of $X$ is $n-k$ is to check the above condition.
If $k=1$ and $f_1\neq 0$ we're good.
Let's see how it goes for $k=2$. Let's suppose that $f_1\neq 0$ and that $f_2 $ is not contained in the ideal $(f_1)$. Now, you have to check that the image of $f_2$ in $k[x_1,\ldots,x_n]/(f_1)$ is regular. So you compute the quotient and check if it's an integral domain. If it's an integral domain, we're good. If not, it might be a bit more difficult to check if $f_2$ is regular in $k[x_1,\ldots,x_n]/(f_1)$. I wouldn't know a fast way of checking if this element is a non-zero divisor at the moment.
This is not a complete answer but I hope it at least helped a bit.
Edited: the proof below assumes $k$ is algebraically closed. The proof for the multiplicity inequality has been added.
Given $x \in X := V(f_1, \ldots, f_m)$, let $k$ be the local dimension of $X$ at $x$ (i.e. $k$ is the maximum of the dimension of all irreducible components of $X$ containing $x$).
Claim: $mult_x(X) \leq $ the product of the largest $n-k$ elements of the sequence $\deg(f_1), \dots, \deg(f_n)$.
If $k = 0$, then the claim holds due to Bézout's theorem. This estimate is also sharp: given degrees $d_1, \ldots, d_n$, take generic homogeneous polynomials of the specified degrees in $n$-variables - they intersect only at the origin, and the multiplicity at the origin is precisely $\prod_i d_i$ due to Bézout's theorem.
In the case that $n > k \geq 1$, we will prove the following
Sub-claim 1: For each $j = 1, \ldots, n-k$, there are $g_1, \ldots, g_j$ such that each $g_j$ is a linear combination of the $f_i$, and $V(g_1, \ldots, g_j)$ is a complete intersection on a neighborhood of $x$.
Proof: Proceed by induction on $j$. For $j = 1$, set $g_1 := f_1$. If $k = n - 1$, then stop. Otherwise, for $2 \leq j \leq n - k$, we can assume by induction we found $g_1, \ldots, g_{j-1}$ such that $V(g_1, \ldots, g_{j-1})$ is a complete intersection on a neighborhood of $x$. We claim that there is a linear combination of the $f_1, \ldots, f_n$ which does not identically vanish on any irreducible component of $V(g_1, \ldots, g_{j-1})$. Indeed, otherwise since $k$ is infinite, we can find $m$ linearly independent linear combinations of $f_1, \ldots, f_m$ which vanish identically on one of the irreducible components of $V(g_1, \ldots, g_{j-1})$ containing $x$, which would mean that the local dimension of $X$ at $x$ is $n - j + 1 > k$, a contradiction. Now let $g_j$ be that linear combination of the $f_i$ which does not identically vanish on any irreducible component of $V(g_1, \ldots, g_{j-1})$, and repeat. $\square$
Once you find $g_1, \ldots, g_{n-k}$ as above, let $Y := V(g_1, \ldots, g_{n-k})$. The second observation is that $mult_x(X) \leq mult_x(Y)$, which follows from the following general fact:
Sub-claim 2: Let $X \subseteq Y \subseteq k^n$ be a chain of closed subschemes and $x$ be a closed point of $X$ such that $X$ and $Y$ have the same local dimension at $x$. Then $mult_x(X) \leq mult_x(Y)$.
Proof: For each $q \geq 0$, there is a surjection
$$O_{x,Y}/m_x^qO_{x,Y} \to O_{x,X}/m_x^qO_{x,X}$$
where $m_x$ is the ideal of $x$. Treating this surjection as an $O_{x,Y}$-module homomorphism, it follows that
$$l(O_{x,Y}/m_x^qO_{x,Y}) \geq l(O_{x,X}/m_x^qO_{x,X})$$
where $l$ is the "length" (see e.g. Atiyah-Macdonald, Proposition 6.9). By the assumption on dimension, for $q \gg 1$, both of these lengths are given by polynomials in $q$ of degree $d$, where $d := \dim_x(X) = \dim_x(Y)$. It follows that the coefficient of $q^d$ in the polynomial providing the values of $l(O_{x,Y}/m_x^qO_{x,Y})$ can not be smaller than the corresponding coefficient of the polynomial for $l(O_{x,X}/m_x^qO_{x,X})$. $\square$
The third observation is that if one of the $f_i$ appears in linear combinations defining more than one $g_j$, say $g_{j_1}, g_{j_2}$, then replacing $g_{j_2}$ by an element of the form $g_{j_2} + ag_{j_1}$ for an appropriate $a \in k$ we may ensure that $f_i$ does not appear in the linear combination defining $g_{j_2}$. In this way we can find appropriate "invertible" linear combinations $g'_1, \ldots, g'_{n-k}$ of $g_1, \ldots, g_{n-k}$ such that
- $V(g_1, \ldots, g_{n-k}) = V(g'_1, \ldots, g'_{n-k})$, and
- there is a reordering of $f_1, \ldots, f_n$ such that $\deg(g'_j) \leq \deg(f_j)$, $j = 1, \ldots, n-k$.
The final observation is that $mult_x(Y) = mult_x(Y \cap H)$ for a generic affine subspace of dimension $k$ containing $x$. On the other hand, if $h_1, \ldots, h_k$ are linear polynomials such that $x$ is an isolated point of $V(g'_1, \ldots, g'_{n-k}, h_1, \ldots, h_k)$, then we are done by the $k = 0$ case.
Best Answer
What's happening is that indeed the degree of your curve (when it is a curve) is the product of the degrees of the $p_i$, counted with multiplicity! In other words, the intersection scheme has that degree.
In your example in the last paragraph, the intersection is actually $d\cdot C$, so getting degree $d$ for $C$ is the correct answer. The issue is that in this example the intersection multiplicity of the defining equations is $d$ everywhere along the intersection.
Here is a specific example to see what's happening: Let's say that $d=2$, $f_1(z)=z^2+l_1(z)$ and $f_2(z)=z^2+l_2(z)$ where the $l_i$ are linear polynomials in $z$. Then the ideal generated by $x-f_1(z)$ and $y-f_2(z)$ contains $x-y+l_1(z)-l_2(z)$, a linear polynomial and you get the same ideal with the generators $x-f_1(z)$ and $x-y+l_1(z)-l_2(z)$. If you take the intersection of these two hypersurfaces, then you get the correct degree $d=2$. You can easily see that if you take a local ring of the ambient space at a point of the intersection curve, then the original defining equations are both in the square of the maximal ideal, so their intersection multiplicity has to be (at least) $2$.
By the way, intersection theory should be really done in the projective space.