Soccer is called “soccer” because it’s a nickname for “association football”.
Rugby is technically called “rugby football” because it was invented at the Rugby School, which is an old posh English boarding school.
American football/NFL was originally known as “gridiron football”.
They’re all differently evolved codes of the family of sports of “football”, because they’re played with a ball, on your feet, and at various points you kick that ball.
This is all historical etymology shit, it doesn’t fully make sense for all cases and isn’t a perfect closed system so please don’t start questioning it too much.