The quick answer is from both - its roots can be traced back to ancient Mesoamerica, salsa's transformation from sauce to dip took a while. This essential American party snack is something out of the ordinary in Latin America, where instead of a standalone, you'd see it included inside a variety of dishes. The Aztecs' condiment closest to our modern Tex-Mex table staple also included tomatoes and chiles, but they threw in squash seeds. In 1571, Alonso de Molina, a linguistically inclined priest, deemed it "salsa."
As the ingredients became domesticated, their wider availability helped transport Mexican cuisine to the United States. Although bottled hot sauces were already making their way to the table by the late 1800s, salsa as a dip began to take hold in the early 1900s, when they found their place in community cookbooks. By the Forties, salsa had taken hold throughout the Southwest and quickly became a staple in metropolitan kitchens.