If you want to be an astrophysicist, the first thing you'll have to do is to abandon SI units, and start using cgs units$^\dagger$. In these units the Sun's opacity at 5000 Å is
$\kappa_{5000} = 0.3\,\mathrm{cm}^2\,\mathrm{g}^{-1}$
and the Earth's density is
$\rho = 1.2\times10^{-3}\,\mathrm{g}^2\,\mathrm{cm}^{-3}$.
Mean free path
You can calculate the answer in different ways, and you already did calculate it in terms of the mean free path
$$
\ell = \frac{1}{\kappa\rho} = \frac{1}{n\sigma}.
$$
The second equality expresses the absorption as number density $n$ of particles, each of cross-sectional area $\sigma$. In other words, $\kappa$ and $\sigma$ express the same thing, namely a probability of being absorbed, but per unit mass and unit number, respectively).
The equation gives you the distance a beam of light can travel before the number of particles in the beam, times their cross section, equals the area $A_\mathrm{beam}$ of that beam. In other words, how far before you have encountered enough particles to completely cover your line of sight (LOS).
Optical depth
Particles are not perfectly arranged to cover your LOS, but can "be behind each other"$^\ddagger$.
If your beam travels a very short distance $ds$, so short that no particles "cover each other", it will cover a volume
$V = A_\mathrm{beam}\,ds$,
and the total number of particles inside this volume will be
$$
N = nV = n A_\mathrm{beam}\,ds.
$$
The total area covered by particles is then
$
A_\mathrm{par} = N\sigma.
$
The covered area fraction tells you the probability of being absorbed a particle:
$$
dP_\mathrm{abs} = \frac{A_\mathrm{par}}{A_\mathrm{beam}}
= n\,\sigma\,ds.
$$
The optical depth $\tau$ is defined as the integral of this probability over some distance $s$:
$$
\tau = \int_0^s\,n\sigma\,ds' = \int_0^s\,\kappa\rho\,ds'.
$$
In general this can be a complex integral, but in the case of a constant density, the integral just becomes $\int_0^s\,ds = s$, so the optical depth is
$$
\tau = n\sigma s = \kappa\rho s.
$$
If the intensity $I$ of the light in the beam decreases by $dI$ by traveling a distance $ds$, then
$$
dI = -In\sigma ds.
$$
This differential equation has the solution
$$
I(s) = I_0 e^{-n\sigma s} = I_0 e^{-\tau},
$$
where $I_0$ is the intensity of the beam before entering the medium.
Thus we see that the physical interpretation of $\tau$ is the distance that a beam of light can travel before its intensity is decreased by a factor $e$. Or we can say "before it's significantly decreased".
Very often, a medium will have either $\tau\ll 1$ or $\tau\gg 1$, which we call "optically thin" and "optically thick", respectively, or just "transparent" or "opaque". The intermediate distance corresponding to $\tau=1$ is the distance you can see in the medium before it becomes too opaque to see any further. This distance is
$$
\begin{array}
{} 1 & = & n \sigma s = \kappa\rho s\\
& \Rightarrow & \\
s & = & \frac{1}{n \sigma} = \frac{1}{\kappa\rho},
\end{array}
$$
and defines the mean free path (which we called $\ell$ above).
So now you have the origin of your result.
$^\dagger$Except for wavelengths in the UV/optical which should be in Ångström (Å), brightnesses which should be in negative $\log_{2.51}$ units, metallicities in log(O/H) + 12 units, and numerous other historical mishaps…
$^\ddagger$Though at the particle level, you shouldn't really think of each particle acting like a little disk that absorbs everything inside its are, and doesn't absorb anything outside its area. Rather each particle has "a probability of absorbing sufficiently nearby photons". This probability can then be expressed as a classical cross section with units of area.