Because of the writer. Francis Scott Key owned slaves.
I’m sure we’re all familiar with the full lyricss, as the “anthem” portion is only the first verse.
And where is that band who so vauntingly swore
That the havoc of war and the battle’s confusion,
A home and a country, should leave us no more?
Their blood has washed out their foul footsteps’ pollution.
No refuge could save the hireling and slave
From the terror of flight, or the gloom of the grave
And the star-spangled banner in triumph doth wave,
O’er the land of the free and the home of the brave.