I've noticed that outside of the period between Rosh ha-Shana and 31 of December (included) the last digit of the current year in both systems is always the same, e.g. 5779 - 2019
What are the origins of this agreement or is it just a coincidence?
UPD this update will remain here
The Anno Domini era which is used to number the years of both the Gregorian calendar and the Julian calendar was introduced in 525 by Scythian monk Dionysius Exiguus (c. 470–c. 544), who used it to identify the years on his Easter table. He introduced the new era to avoid using the Diocletian era, based on the accession of Roman Emperor Diocletian, as he did not wish to continue the memory of a persecutor of Christians.
In the preface to his Easter table, Dionysius stated that the "present year" was "the consulship of Probus Junior [Flavius Anicius Probus Iunior]" which was also 525 years "since the incarnation of our Lord Jesus Christ" without stating when this event occurred in any other calendar. How he arrived at that number is unknown.
The year 525 calculated by the monk appears to have coincided with the Jewish year ending with 5, hence the correspondence. Whether this was natural result of the calculations, deliberate or pure chance will remain a mystery.