I'm not an expert on the subject, but can relay what I learned from the book "The Western Esoteric Traditions", which has an account of the more esoteric side of freemasonry, known as "High Grade Freemasonry". In the early-to-mid 1700s, these lodges appeared in France and Germany claiming descent from the Scottish lodges. While typical freemasonry dealt with three "Craft Degrees", these lodges gave higher order degrees based on initiations into mysticism.
Michael Ramsay was the first to do this, and combined elements of Egyptian mysticism with a Knight's Templar origin story, and threw in some biblical references to Solomon's temple as well. By 1758, this form of Freemasonry also spread to Germany.
Again, I'm not an expert, but I hope this gives you enough info to find further reading if you don't get any better replies here.
The actual history and purported history are different. I guess the question is - what specifically are you asking? The history of Freemasonry would take volumes to document (and has - there are many books). Some Freemasons feel a connection to the Knights Templar as the basis for the order, but there's nothing concrete to support that theory. We do know that the United Grand Lodge of England (UGLE) was formed in 1717 and that lodges existed prior to the Grand Lodge's formation with the earliest lodges being located in Scotland. But today, all blue lodges in the US (ones that have the first 3 degrees) are "descended" (chartered) directly or indirectly from the UGLE. There are also two "rites" that extend the first 3 degrees - York and Scottish. But a standard Masonic lodge in the US is a "blue lodge" with the first three degrees - Entered Apprentice, Fellowcraft, and Master Mason.
Hope that helps give a little background, but if you want to know, let me know. Source: I have been a Freemason for 15 years and am a past Master of my lodge (highest office in a blue lodge).