While the exact timeline is debated, it's generally accepted that Spanish developed from Vulgar Latin, the everyday language spoken by Romans in the Iberian Peninsula, after the fall of the Western Roman Empire. This process involved the influence of other languages, like Arabic and Basque, and continued for centuries.
It's important to note that while Spanish originated in Castile, it later spread throughout Spain and eventually became the official language of the entire country.