Hajnówka was first mentioned in documented sources in the 17th century as a king watchtower was built here to guard the Białowieża Primeval Forest. In the 19th century a settlement was founded here and afterwards a forest. Eighteen families were settled in that time in Hajnówka. During the January Uprising fights took place in the area. At the turn of the 19th and 20th century a railway reached Hajnówka.

In the interwar period Hajnówka was very prosperous as the wood processing industry was developing. There was an English company in the locality that illegally chopped down the trees to process them. Four further big manufacturers specialized in wood processing and employed 2,000 people.

In WWII Hajnówka was under Soviet and afterwards German occupation. In that time, the railway station and the synagogue were ruined. After WWII a strong independence movement (Major Łupaszka’s units) was active in the area. In 1951 Hajnówka was granted city rights.