How do people know, say, that some specific event happened in China 1200 BC? Or the Mayans did something in AD 150? Back then, didn't they all use a different calendar system?
The term you're looking for is chronology (Wikipedia's article on the subject is rather sub-par).
In general, there are two major ways of synchronizing dates.
Find an event recorded in more than one calendar. For example, if a treaty was signed on "a.d. VIII Kal. Oct, Julius et Caesar consulibus" and "220.127.116.11.14", you can establish an equivalence between the two and convert dates back and forth; a sufficient chain of conversions will let you figure out what the date would be in a modern system. In practice, you'll want multiple dual-dated events, because of errors in the historical record.
Find an astronomical event that was recorded with a date. Total solar eclipses are especially good for this, since they're rare and only visible from a small area. If you've got even a "within a century or two" idea of how the calendar you're working with aligns to the modern dating system, there's usually only one eclipse that's a candidate. Again, you want multiple events to deal with possible error (eg. an annular eclipse that was recorded as total, or a "great comet" that was on a hyperbolic orbit rather than the short-period comet you thought it was).