The Piazza di Spagna got its name from the Spanish Embassy to the Holy See, which has been located here below the Spanish Steps since the 17th century.
This is NOT the Spanish embassy to Italy, which is located somewhere else in Rome.
Due to the lack of space at the Vatican City, foreign missions to the Vatican are located in Rome outside of the Vatican City.