Rugby is rugby. We still call that rugby.
American football is called that because it was historically in a wider class of sports called “football” which includes rugby and association football/soccer. I think they still use that sort of broad term in Australia, actually.
Anyways, there was a time where association football in some universities in the UK was shortened to soc or something like that which led to some people calling it soccer.
Over time as dialects shifted apart, the US, Canada, Australia, and South Africa leaned more towards calling it Soccer whereas the UK leaned more towards calling it football. From what I understand in Ireland some people use the terms interchangeably.
And gridiron football in the US eventually became the thing called football there or now commonly called American football elsewhere.