I am interested in learning why katakana was chosen to represent foreign words.
Because that's the original purpose of katakana. Katakana was invented to denote the readings of unfamiliar foreign words (although, in those days, "foreign words" mainly referred to words in Asian languages such as Sanskrit, Pali, Chinese). On the other hand, hiragana developed as the shorthand for native Japanese sentences written in Manyo-gana. For details, please read the following questions:
The Japanese writing system underwent multiple major overhauls in the last 1500 years, but one main role of katakana basically remained the same: to serve as the phonetic alphabet to purely represent the sounds of non-ordinary words.
The Japanese writing system consists of three scripts, hiragana, katakana and kanji.
To make a foreign word a loanword, the first step is to choose a transliteration which is given in kana (either hiragana or katakana).
The second step of also assigning it a kanji is not necessary. (And usually not done anymore; ateji such as 天ぷら, 煙草【たばこ】, etc. are still used, but there are few newly coined ateji).
Choosing katakana over hiragana for loanwords (of foreign origin) fits well with the origin of katakana of being a shorthand for Sanskrit (or Pali) sounds written with Chinese characters.
One major difference between katakana and hiragana is that there was only a fairly minimal set of katakana. However, there was a large set of cursive characters with many different forms for the same sound. Of these, a minimal set was selected and called hiragana. Those forms that didn't make it were called hentaigana.
In any case, katakana is now the default script for loanwords (by the regulatory body 文部科学省 Ministry of Education, Culture, Sports, Science and Technology) and has been probably since the post-WWII writing reform (1946).
However, before said writing reform, there are also publications with the roles of katakana and hiragana interchanged:
Source: 藤原松三朗 「和算史ノ研究」 (東北数学雑誌 Vol. 46, 1940)
It is said that it was originally meant for foreign words, but some guys tend to oversimplify the matter for pedagogical purposes. It's not that easy a question, because the roles of katakana have changed over time. Until some decades, you would still find katakana instead of hiragana for the transcription of particles. Even today, it can be used to emphasize native Japanese words, much like we would use Italics in some Western languages. Also, for words, whether native or foreign in origin, that bear a scientific meaning where they could be mistaken for their cultural connotations, such as names of animal or plant species. Also, for onomatopoeic expressions, especially if they depict actual sounds instead of emotions.