In early Christian music, these seven letters were assigned to important notes in the scale. These notes were called "syllables," and each syllable was assigned to a different pitch based on its position on the scale. For example, the note C was called "Do," and the note D was called "Re."
Later, the names of these syllables were shortened to just the first letter of each syllable, resulting in the seven letters we use today to represent musical notes.