The people who edited the latest edition of the DSM literally said they would not have included an entry for gender dysphoria except that if they hadn’t it would be even easier than it already is to deny coverage/care to trans folks.
It may be classified as a mental illness due to it having debilitating long-term effects on the psyche when one is suffering from dysphoria such as not functioning in day-to-day life. It's transphobes that use the label to try and justify the argument that the effected person is incapable of making informed decisions about their own wellbeing. The same kinda people are of the conviction that the "mental illness" is of contagious nature, basically saying that being trans is more of a threat to everyone around them than to the psyche of the effected person (due to possible dysphoria)
Hint: That's not how mental illnesses work.