$\newcommand\L{\mathbb{L}}\newcommand\P{\mathbb{P}}\newcommand\A{\mathbb{A}}\newcommand\C{\mathbb{C}}$ Since you're trying to learn algebraic geometry, I'll assume that we're talking about complex projective spaces.
$\P^1$ does indeed consist of all lines in $\C^2$ passing through the origin. Any line that does NOT pass through the origin is an affine line. If we denote such a line by $\A^1$, then there is a natural map
\begin{align*}\A^1 &\rightarrow \P^1\\
p &\mapsto \ell,
\end{align*}
where $\ell$ is the line through the origin that intersects $\A^1$ at $p$. There is only one line through the origin that does not intersect $\A^1$, namely the line parallel to $\A^1$. That point in $\P^1$ is called the "point at infinity".
Recall that homogeneous coordinates is a map
\begin{align*}
\pi: \C^2\backslash\{0\} &\rightarrow \P^1\\
(z^1,z^2) &\mapsto [z^1,z^2],
\end{align*}
$[z^1,z^2] \subset \C^2$ is the line that contains $(0,0)$ and $(z^1,z^2)$.
Now let $$\A^1 = \{ (1,z)\ :\ z \in \C\}\text{ and }\L^1 = \{ (0,z)\ : z\in\C\} $$
There are bijective maps
\begin{align*}
\C &\rightarrow \A^1 \stackrel{\pi}{\rightarrow} \P\backslash\L\\
z &\mapsto (1,z) \mapsto [1,z].
\end{align*}
This defines affine coordinates on $\P\backslash\L$. More generally, given any affine line $\A^1 \subset \C^2$, there is an affine parameterization $$a: \C \rightarrow \A^1$$ and affine coordinates with respect to this affine line is the bijective map
\begin{align*}
\C &\stackrel{a}{\rightarrow} \A^1 \stackrel{\pi}{\rightarrow} \P^1\backslash\L,
\end{align*}
All of this generalizes to higher dimensions in a straightforward way.