This designation was given to him by the Ministry of Magic because of his political and magical opposition to the tyrannical rule of Lord Voldemort. The Ministry, under the influence of Voldemort's supporters, considered Dumbledore a dangerous and subversive figure.
The term "Undesirable No. 1" highlights the power dynamic in the wizarding world, showcasing the Ministry's willingness to label and ostracize anyone who defied their authority, especially someone as prominent and influential as Dumbledore.