The MPAA rating system when it first came out was:
G – General
M – Mature
R- Restricted
X -No one under 17
M was changed to GP after a few years, and then that was changed to PG. PG 13 was added for films like Indiana Jones and the Temple of Doom that was a Spielberg but had a live human heart being extracted.
By 1990, any X rated movie was assumed to be porn. The porn industry had adopted “Rated X” in the 1970s, so the MPAA came up with NC 17 for adult “artistic” films that were not porn.
By the late 70s/early 80s, with all adult films called Rated X, “XXX” was adopted by porn makers as an advertising gimmick to mean a flick was even raunchier and more explicit than just any old X movie.