Why does an eclipse happen?

A solar eclipse happens when the Sun is covered by the Moon.

A lunar eclipse happens when the Moon gets into Earth's shadow.