Historically speaking, this area was called ”Samantra prathet" long before it got to be called Lamphun.
After the fall of Samantraprathet, the city was recovered as "Hariphunchai Nakorn" around 661 A.D. In 663, Princess Cham Thewi (or Chama Thewi or ChamDevi; daughter of the King Of Lawo or Lawapur) was invited to become a queen in 663 A.D. , then the Haripunchai kingdom started. She brought civilization from Dvaravati (the kingdom in central Thailand around the 6th to the 13th centuries) to Northern Thailand for the first time.
She gathered various native tribes and ruled them under her Ten Royal Virtues, then proclaimed Buddhism by establishing temples throughout the land and extended the civilization to other river basins such as Wang river and Ping river. While she was in the order of the ten-precept nun, she performed countless good deeds and that's why she was called "the Beloved Queen" of Lanna people