But this is odd as they sound so different! How are they related?
It’s not obvious, but it’s easy once you understand the pattern: The Latin sound “sh” and very similar sounds (such as the “ch” and “sy”) almost always became a “j” in Spanish. Like syrup and jarabe. Not obvious!