A straight line is in $1$ dimension, A square in $2$, but what about a curved line? A straight line looks the same no matter how you look at it but a square doesn't. It looks like a straight line if looked sideways. But a curved line, if looked sideways it looks a shorter straight line. So which dimension does it belong to?
Thanks.
A "well-behaved" curve$^\dagger$ such as the ones I think you have in mind, exist in $2$D-space, but the object itself is $1$-dimensional. There is only $1$ degree of freedom at any point: going forward / backward. In concrete terms, if $\alpha: \mathbb{R} \rightarrow \mathbb{R}^2$ is a parametrization of a line and $\beta$ a homeomorphism from the line to the curve, then the function $\beta(\alpha(t))$ gives the curve with choice of $t$ providing the degree of freedom.
Another example: a hollow sphere of radius $r$ exists in $3$D-space, but the sphere itself is $2$-dimensional. Specifically, it has parameterization $\alpha(u, v) = \left[ \begin{matrix} r\cos(v) \cos(u) \\ r\cos(v) \sin(u) \\ r \sin(v) \end{matrix} \right]$ where, if one is standing at a point, varying the $u$-value provides one degree of freedom and varying the $v$-value the other. Another way of thinking about this is to note that a neighborhood about a point on a sphere resembles $\mathbb{R}^2$ (the sphere is a manifold). In the plane, any movement in any direction can be decomposed into a horizontal movement and a vertical one: two degrees of freedom / two dimensions.
$^\dagger$ The Hilbert curve is an example of a curve that is not well-behaved.