Actually, both the Sun and the Moon have gravitational pull, and it is incorrect to say that only the Sun has gravitational pull. Gravitational pull is a fundamental property of all objects that have mass. The reason people often mention the Sun's gravitational pull more frequently is due to its significantly larger mass compared to the Moon.
The Sun is by far the most massive object in our solar system, accounting for more than 99% of the total mass. Its immense gravitational pull governs the motion of all the planets, including Earth. The Sun's gravitational force keeps the planets in their orbits and plays a significant role in shaping the dynamics of the solar system.
On the other hand, the Moon also has a gravitational pull, although it is comparatively much weaker than the Sun's due to its smaller mass. The Moon's gravitational pull primarily affects the tides on Earth. The gravitational interaction between the Moon and the Earth creates tidal forces that cause the oceans to bulge, resulting in the rise and fall of the tides.
So, both the Sun and the Moon have gravitational pull, but due to the vast difference in their masses and the various effects they have on our daily lives, the Sun's gravitational pull is often emphasized more when discussing celestial bodies.