Why is the moon's shadow cast on earth during a solar eclipse?

This is not really a "why" sort of question.

The moon has a shadow, because it's a solid opaque object.

The moon's shadow sometimes falls on the Earth, because the Earth, Moon, and Sun are sometimes arranged so that that can happen.

When that happens, we call it a solar eclipse. We could call it a mumblefrazz instead, and then I suppose you'd be asking why the moon's shadow was cast on Earth during a mumblefrazz.

If the moon were smaller, or further away, its shadow would never fall on the earth (technically, its penumbra or anteumbra still would, but its umbra would not) and we'd never experience total mumblefrazzes.