Both are loanwords
What is a loanword? It sort of does what it says on the tin. It is a word one language loans or lends to another (though the lender doesn’t usually get it back, and no interest is paid, boom boom). And the word loanword is itself a loan translation, purloined from German Lehnwort. (Actually, the term ‘loanword’ is not quite as straightforward as that, but for the moment, let’s keep things simple, eh?)
English is full of loanwords, as are most, if not all, European languages.
Both come from Spanish
Our alligator combines the Spanish word for ‘lizard’, lagarto, and the Spanish definite article, el ‘the’. So, if you run the two together you get elligarto, which eventually was standardized as alligator, though spelt in at least a dozen different ways before standardization.
The word first appeared in its Spanish form lagarto in translations into English in the second half of the 16th century. It made one of its early appearances in Romeo and Juliet, when Romeo is describing an impecunious apothecary’s shop:
And in his needie shop a tortoyes hung, An allegater stuft, and other skins Of ill shapte fishes, and about his shelves…
That is the spelling in the 1599 Quarto; in the 1597 Quarto it is Aligarta, which illustrates just how indeterminate the spelling originally was.
In the first half of the 17th century we find Sir Walter Raleigh and Ben Jonson still using the more Spanish spelling: Alegartos and Alligarta respectively. So why did the letters rt of that final -arto or -arta get swapped round to -ator? The OED suggests that it was by association with the agent suffix -ator, found in administrator, imitator, and so on.
This change of form suggests the influence of folk etymology: the process by which people distort the shape of a strange, unfamiliar word to make it fit in with a more familiar word or pattern. Folk etymology is the villain behind many eggcorns.
(Curiously, there is a homonym of alligator, marked as obsolete and rare by the OED, shipped in straight from Latin in the sixteenth century. It means ‘someone who binds’ from the classical Latin alligātor from the verb alligāre, ‘to tie, bind’, etc., related to the Latin ligāre, which gives us, for example, ligature, and has been taken into Spanish as ligar.)
Hardly anyone who reads this will be ancient enough to remember the catchphrase my older brother Rupert taught me: ‘See you later alligator’, to which the appropriate reply is ‘In a while, crocodile!’ It first appeared in 1954, but was popularized thereafter by a Bobby Charles song of 1955. I think it didn’t reach my ears, courtesy of Rupe, till the early 1960s.
A cacarootch by any other name would be just as revolting
The ultimate shape of the word alligator suggests the influence of folk etymology on a mere suffix. With cockroach, the process transformed both elements of another Spanish word, cucaracha, into recognizable English ones: cock + roach. Many people will know the original word from the popular Mexican song:
La cucaracha, la cucaracha,
ya no puede caminar
porque no tiene,
porque le falta
las dos patitas de atrás.
(The cockroach, the cockroach
Can’t walk anymore
Because it hasn’t
Because it’s missing
Its two rear leglets.)
The repellent bug first appeared in print in 1624 in The Generall Historie of Virginia, New-England, and the Summer Isles by John Smith, a picaresque character who was a soldier and Virginia’s first colonial governor:
A certaine India Bug, called by the Spaniards a Cacarootch, the which creeping into Chests they eat and defile with their ill-sented dung.
Its spelling, like that of alligator, inevitably went through several mutations, before folk etymology pinned it down to its modern shape. For a long time it was hyphenated, and appears as Cock-roach in Darwin’s Origin of Species (1859).
Since we’ve mentioned folk etymology, a more recent example of folk etymology in action is chaise lounge, adapted from the French chaise longue. The word longue undoubtedly looks odd in English (a rare parallel is tongue), but a chaise longue is ideal for lounging; the alteration therefore seems quite logical. (Some, like Le Corbusier’s iconic creation, are more for show than serious lounging.) While chaise lounge is predominantly American, and not generally recognized as a correct British spelling, the OED shows it first in an impeccably British source: an edition of The Times of 1807.