Originally named Khok Sa-Met Choon, Hat Yai was a small village until
the southern railway was built there. The junction which connected the
town of Songkhla with the main route was originally located in the
Utapao area, but was moved to Khok Su-Met Choon in 1922 when the Utapao
area turned out to be flood prone. Khok Su-Met Choon had only four
residences at that time, but due to the investments of Khun
Niphatchinnkhon, Jia Gi Si, 1886–1972, Hakka Chinese), the railway contractor for the railway connection from Nakhon Si Thammarat to Pattani, it quickly grew into a small town.
In 1928 Hat Yai was made a Chumchon, which was upgraded to a sanitary district (sukhaphiban)
on December 11, 1935. It covered an area of 4.4 km², and was
administrated by the first mayor Udom Bunlong. In 1938 the municipal
administration building was completed. On March 16, 1949 it was granted
town status (thesaban mueang);
on May 10, 1961 the area covered by the municipality was increased to
8 km². Due to the continuing growth, on August 13, 1968 a new larger
municipal administration building was opened. On April 24, 1977 the area
of the municipality was enlarged a second time to 21 km². Finally in
1995 it was upgraded to city status (thesaban nakhon).