According to the Star Wars wikia, Lor San Tekka lived in the Western Reaches of Jakku about 29 years after the Battle of Jakku, which took place approximately one year after the Battle of Endor. He was a follower of the Church of the Force, a religion that based its faith on the ideals of the Jedi.
Further information about him from his official entry in the official starwars.com databank entry:
A legendary traveler and explorer, Lor San Tekka is a longtime ally of the New Republic and the Resistance. After the Battle of Endor, San Tekka helped Luke Skywalker recover secret Jedi lore that the Empire had tried to erase, and Leia Organa hopes the old scout can now help find her brother. Following decades of adventure, San Tekka retired to live simply on Jakku, where he follows the dictates of the once-forbidden Church of the Force. But his retirement is fated to be anything but peaceful.
As to how he came to be in possession of the final piece of the map that would lead to Luke, exactly, that may be revealed in later films.