Consider a vector, $\mathbf v=(a,b,c)$, in $3$-space. We can project this onto the $xy$-plane, say, producing the vector $(a, b, 0)$ which we can identify with the $2$-vector, $(a, b)$. This two vector corresponds to the hypotenuse of a right triangle whose side lengths are $a$ and $b$. Therefore the squared length of this vector is $|(a,b)|^2 = a^2 + b^2$ according to the usual Pythagorean formula for a right triangle. But now we can consider the plane spanned by $(a,b,0)$ and $\mathbf v$, and in that plane view $v$ as the hypotenuse of a right triangle with side lengths $|(a,b)|$ and $c$. The squared length of the vector $\mathbf v$ is $|(a,b)|^2 + c^2 = a^2 + b^2 + c^2$. This logic can be extended to any dimension via an inductive argument showing that $|(a_1,\dots,a_n)|^2 = |(a_1,\dots a_{n-1})|^2 + a_n^2$.
That said, there are many other (probably better) ways of thinking about this. For example, *any* two vectors (in any dimension) gives rise to a (potentially degenerate) triangle in the plane spanned by those vectors (which will be ambiguous if they are linearly dependent). Namely, given vectors $\mathbf u$ and $\mathbf v$, we can consider the triangle $ABC$ such that the $A + \mathbf u = B$, $B + \mathbf v = C$ and thus $A + (\mathbf u + \mathbf v) = C$. The squared length of the "hypotenuse" $\overline{AC}$ is $$(\mathbf u + \mathbf v) \cdot (\mathbf u + \mathbf v) = \mathbf u \cdot \mathbf u + 2\mathbf u \cdot \mathbf v + \mathbf v \cdot \mathbf v$$ where $\cdot$ represents the dot or inner product and $\mathbf u^2 = |\mathbf u|^2 = \mathbf u \cdot \mathbf u$. The triangle will be a right triangle when $\mathbf u$ and $\mathbf v$ are orthogonal, i.e. at $\pm 90^\circ$ to each other in the plane they span. This is represented by $\mathbf u \cdot \mathbf v = 0 = |\mathbf u||\mathbf v|\cos(\pm 90^\circ)$. We now get a more abstract rendition of the Pythagorean theorem; now in any dimension and for any inner product space.