Let us for simplicity consider a bosonic string $X:\Sigma\to M$ in the matter sector only (as opposed to the ghost sector). Here $M$ is a target manifold. The worldsheet $\Sigma$ is a Lorentzian manifold of real dimension 2.
Locally in a neighborhood $U\subseteq \Sigma$ of the worldsheet, we may work in a so-called conformal gauge, which means to choose a worldsheet metric equal to the flat 2-dimensional Minkowski metric
$$ \tag{1M} \mathrm{d}\sigma^1 ~\mathrm{d}\sigma^1-\mathrm{d}\sigma^0 ~\mathrm{d}\sigma^0~=~-\mathrm{d}\sigma^{+} ~\mathrm{d}\sigma^{-}. $$
Here
$$ \tag{2M} \sigma^{\pm}~=~\sigma^0\pm\sigma^1 $$
are light-cone coordinates.
We will assume that it is possible to Wick rotate to an Euclidean signature. We identify the local Wick-rotated coordinates (of Euclidean signature) with a single independent complex coordinate $z=x+iy\in \mathbb{C}$. Normally, one assumes that the Wick-rotated worldsheet $\Sigma$ globally form a Riemann surface.
We stress that the complex conjugate variable $\bar{z}=x-iy$ is fundamentally not an independent variable, although one may in certain calculations get away with treating it as an independent variable. For a very similar discussion of dependence of a complex variable and its complex conjugate, see this Phys.SE post.
The Lagrangian density in such local coordinates becomes
$$\tag{3M} {\cal L} ~\sim~ \partial_{+} X^{\mu}~ \partial_{-}X_{\mu}. $$
This means that the classical equation of motion is just the wave equation
$$\tag{4M} \partial_{+}\partial_{-} X^{\mu}~\sim~ \Box X^{\mu}~=~0.$$
The full solution to the wave equation (4M) is left- and right-movers
$$\tag{5M} X^{\mu} = X_L^{\mu}(\sigma^{+}) + X_R^{\mu}(\sigma^{-}).$$
If we Wick-rotate the worldsheet metric to the Euclidean signature, then the left- and right-movers in eq. (5M) become holomorphic and antiholomorphic parts, respectively:
$$\tag{5E} X^{\mu} = f^{\mu}(z) + g^{\mu}(\bar{z}).$$
Note that in order to perform the Wick rotation in the worldsheet $\Sigma$, it in general becomes necessary to consider a complexification of the target space $M$. The Wick-rotated classical equation of motion (4M) is just Laplace's equation
$$\tag{4E} \partial\bar{\partial} X^{\mu}~\sim~ \Delta X^{\mu}~=~0,$$
with general complex solution (5E).
The splitting (5E) in holomorphic and antiholomorphic parts for the classical solutions carries manifestly over to the operator formalism (in contrast to the path integral formalism, where the splitting is not manifest). Both sectors in eq. (5E) are needed in a full description to meet pertinent physical requirements.
The splitting (5E) in holomorphic and antiholomorphic parts is also encoded in the CFT representation theory for the partition function $Z$ and the $n$-point correlation functions in terms of a tensor product of conformal blocks. An additional important requirement is modular invariance.