Modern speculative Freemasonry originated in Britain. There are competing thoughts as to whether England or Scotland saw our first lodges. Written records are lost and so we can leave it as a little friendly rivalry between England and Scotland as to where its roots lie.
You will hear many theories on how Freemasonry came into being. The most popular thought is that it is derived from the medieval guild of operative masons who built the cathedrals and churches. Other plausible theories suggest that Freemasonry evolved from the early days of the Royal Society and the activities of the members which it nurtured.
Some put credence in other more esoteric suggestions such as originating from the Knights Templar; the court of the Saxon King Athelstan, the ancient Roman College of Architects, or even Pythagoras or other luminaries of the ancient world. The truth is that we do not know and, more importantly, it does not really matter.
What we do know is that current Freemasonry came into being on the feast day of St John the Baptist in 1717, when the first Grand Lodge was established. The happiness of this event was marred by later dissension which lasted for sixty years and saw the formation of other rival Grand Lodges. That was not resolved until 1813 when the two surviving rivals were reconciled and formed what we know today as the United Grand Lodge of England. This is the body which now governs Freemasonry in England and Wales and Districts overseas.