The anthem playing began at the end of WWI, and was seen as a show of patriotism and a unifying force. Playing the song at sporting events, specifically baseball games, was a way of having tens of thousands of people unite under the flag.
https://youtube.com/watch?v=–Cv18I6gxw%3Fstart%3D1%26feature%3Doembed
While it didn’t catch on completely, it fired back up during WWII. It was everywhere, even before movies and theater performances. Many teams simply stuck with it, but it was during Vietnam where it became basically a full fledged staple.
The US is pretty much the only country that plays the national anthem before domestic events. Some see it as a political game, almost like an indoctrination. Others see it as patriotism, respecting the flag and country. Others, still, see it as faux patriotism – that patriotism doesn’t come from banner waving and chest thumping. And still others see is as respect for those who fought in those battles, and or other civil servants who risk their lives every day to keep us safe.