Here's why:
* Light is a form of electromagnetic radiation. It travels as waves of oscillating electric and magnetic fields.
* The sun emits light. It's a giant ball of hot gas that produces light and heat through nuclear fusion.
* Light travels in straight lines in a vacuum. The sun's gravity doesn't significantly bend the path of light rays passing nearby.
* Gravity affects massive objects. While gravity does bend the path of light over large distances, as seen in gravitational lensing, this effect is very small for light passing close to the sun.
In summary: The sun doesn't attract or repel light waves because light isn't affected by gravity in the same way that massive objects are.