It's kind of a long story that The Atlantic breaks down, but basically, "soccer" was a British slang term for the sport that became popular in the US after American football became a thing. It was a shorter version of the official name, Association Football. (Rugby's official name is Rugby Football. So many footballs.)
Between WWII and the 1980s, when soccer starting getting popular here in the US, Brits used 'football' and 'soccer' interchangeably. But after the '80s the Brits rejected the name because EW AMERICANS. (I'm summarizing, of course.) It's still used by some people in Ireland, though, because they also have Gaelic Football.