It's a coincidence due to the vastly different sizes and distances of the sun and moon.
Here's why:
* The sun is much larger than the moon: The sun's diameter is about 109 times larger than the moon's diameter.
* The sun is much farther away: The sun is about 400 times farther away from Earth than the moon.
These two factors balance each other out:
* The sun's larger size makes it appear larger in the sky.
* The sun's greater distance makes it appear smaller.
The fact that these two effects almost perfectly cancel each other out is a purely coincidental phenomenon.