I was told in school that Tariq and Musa belong to the realm of legend, but I've also heard that some places, like Gibraltar or Tarifa, got their names after Tariq. Did they really exist, or were they fabricated?
Think you may have misunderstood what you learned in school. Tariq ibn Ziyad and Musa ibn Nusayr definitely existed, there's as much evidence in that regards as we have for any other historical figures of that time. What your teacher probably meant was that there are a whole host of legends associated with the two figures that isn't based in fact. The famous story of Tariq ibn Ziyad burning the Umayyad fleet so that no retreat back to Africa was possible is almost certainly fiction. And of course, the Thousand and One Nights and Musa ibn Nusayr finding copper jars with genies is complete legend.
The two men existed, with Tariq ibn Ziyad playing a major role in the Umayyad conquest of Visigothic Hispania under the direction of Musa ibn Nusayr. The legends which accompany them, however, took on their own life afterwards.