Chiangmai is an old city with a proud history. It was founded by King Mengrai who united several tribes and named the new land as Lanna Kingdom. In 1259, he governed the throne and built Chiangrai as his capital in 1262. In 1291, he decided to build a new city as the capital of Lanna Kingdom. He invited King Ramkhamhaeng the Great of Sukhothai Kingdom, and King Ngam Nuang of Phayao Kingdom, both were his close friends, to help select a site for the new city.
They decided to build the new city on a fertile plain between Doi Suthep Mountain and the bank of the Ping River.The new city was completed, surrounded by a moat and wall, in 1296. It was named Nopphaburi Si Nakhonping Chiangmai.
Here are some links where you can read about the history of Chiang Mai.