In Johnson's Standard English-Swahili Dictionary, first published in 1939, "shorts" are translated as "kaputula". Note the "l" rather than the "r". It goes on to say the origin is "Prob. from Nyanja verb 'kubutula', or 'cut off', introduced during the Great War when shorts became known in this part of East Africa" (p.173). There are legitimate regional variations that are not mispronunciations (in the 6 other Swahili dictionaries I own, two say "kaptura", two say "kaptula", and two say "kaputula"), but this makes apparent to me that the "l", rather than the "r" in the Swahili word for "shorts" is the original.
It's not necessarily that r and l are interchangeable, it's that they get confused (chandarua is the proper spelling). There are proper spellings of most/all words, but the distinction between R and L's is very poor. At least in Tanzania, whether it's a swahili or English word, you can regularly hear things being mispronounced/misspelled. It takes time to get used to, especially with words that are very close to others, but you learn to pick up on mispronounced words while learning the correct spelling/pronunciation later.
In a some words in swahili, L and R are interchangable. This is one of them. Another word in duolingo is chanda/r/l/-ua - mosquito net. Maybe someone can come up with other words this applies to?
as far as I know both are used in both Tanzania and Kenya. I don´t know about the other swahili speaking countries. In some bantu languages (in those countries) there is no clear distinction between "l" and "r". That has influenced swahili and made some words have both pronounciations. You can hear some kenyans, wakikuyu and others, say things like "Kalibu chakura!" instead of "karibu chakula!"
some bantu languages have no "l" at all, hence pronouncing l is a problem for some people. Two examples I know are kikuyu and shona.
In Shona in Zimbabwe we call shorts kabudura but the name is borrowed from Malawi Nyanja.
The swahili dictionary gives as a proper form - kaptura ( not kaptula ) and chandalua ( not chandarua ).
A quote from Assimil:
(translated from French)
You might have got the impression of hearing habaLi (instead of habaRi) and you were not mistaken. Some speakers - especially native Swahili speakers say habaRi and others place the tip of the tongue just a tiny bit more ahead on the alveolar ridge and say 'l' . Adopt whichever is more convenient for you.'