My son asked why the letters have to be black, considering there are lots of other colors out there.
The midrash tanchuma below brings this posuk
his locks are curled, [they are as] black as a raven
Rashi black as a raven: All these are beauty for a young man
It seems that black is beautiful
It is conected with the idea of Black fire on white fire
התורה שנתן לו הקב"ה למשה נתנה לו אש לבנה חרותה באש שחורה היא אש מובללת באש חצובה מאש ונתונה מאש דכתיב (דברים לג) מימינו אש דת למו:
The Torah given to Moses was engraved with black fire upon white fire... As it is written (devorim 33.2) His right hand was a fiery Law for them.
Rashi on devorim 33.2
It was originally written before God in [letters of] black fire upon [a background of] white fire. — [Tanchuma Bereishith 1] He gave it to them on tablets, inscribed, [as it were,] by His right hand [thus it is said here, “from His right hand”].
Another explanation of אֵשׁ דָּת : As the Targum renders it, that He gave it to them from amidst the fire.
The beginning of midrash tanchuma
והתורה במה היתה כתובה? על גבי אש לבנה באש שחורה שנא' (שיר השירים,): קווצותיו תלתלים שחורות כעורב, On what was the Torah written (before the world was created)? On white fire, with black fire as it says (shir hashirim 5.11) his locks are curled, [they are as] black as a raven
The leagal reason
@doubleAA brought a source in the comments above
I am bringing it in English
There are ten requirements for tefillin. All of them are halachot transmitted to Moses on Mount Sinai. It is necessary to fulfill them all. Therefore, if one made any changes with regard to them, the tefillin are not fit for use: ... They must be written in ink;
If so, what was excluded by the halachah conveyed to Moses on Mount Sinai, which stated that it be written in ink?
It excludes tints of other colors, such as red, green, and the like. If even one letter of a Torah scroll, tefillin, or mezuzot is in another tint or in gold, they are invalid.
Commentary to halacha 5
If so, - i.e., if there are no specific substances which are excluded, as stated above
what was excluded by the halachah conveyed to Moses on Mount Sinai, which stated that it be written in ink? It excludes tints of other colors, such as red, green -Megillah 17a explicitly disqualifies a megillah written in red ink. From that and other sources, it appears that such ink was frequently used at that time, but was deemed unacceptable for use for a Torah scroll.
and the like. - Note the Bi'ur Halachah (32), which states that even blue ink is unacceptable.
If even one letter of a Torah scroll, tefillin, or mezuzot is in another tint or in gold - Soferim 1:9 relates that a Torah scroll was written for Alexander with every one of the names of God written in gold. When the Sages heard about this, they said that the scroll should be entombed.
Besides excluding the use of gold-colored ink, the Shulchan Aruch (Orach Chayim 32:3) explains that covering the ink with gold dust is not acceptable.
they are invalid. - From this, we learn that all black inks are acceptable, regardless of their makeup. Though scribes continue to make ink in the traditional fashion, there is no prohibition against using commercially produced black ink.
The previous (accepted) answer, unfortunately, says nothing about the REASON for the letters to be black.
[One of] the REAL explanations why, according to the Lurianic tradition is that there are two different parts of the scroll that are called "the Torah" - one is the BLACK of the letters, and the second is the WHITE of the surrounding parchment.
The black part (the actual letters) is one that is read and heard, and that represents the Binah (the "feminine" part), which is the Reduction (צמצום) of the eternal light to our human understanding, as it was done on Mt Sinai (that the Torah took the form of letters).
The white part is one that we (the Hassidishers tradition) look when we say "זאת התורה" as it represents the [unbound] light of the Torah that is the Chochmah (the "masculine" part).
Hence the Halachah that the letters must be black against the white background.
I know, it's a little bit of Kabbalah and hard to comprehend at first, but this proves why it cannot be the other way around in any way!