The primary purpose of diagnosis — any diagnosis, not just ASD — is classification into a category to aid with prognosis, suggest medical and other management that may help based on whether it helped others with the same condition, collect together people with similar conditions to facilitate research, collect data, etc.
It's saying "as far as we can tell from the information we can gather, this person is experiencing the same thing as these other people", which means that instead of having to start entirely fresh with no idea of what's happening with this person and what might be the best thing to do, you have access to lots of data gathered from other people who seem to have had the same thing.
It also means that new information that's gathered from this individual can be added back into the body of knowledge about this condition.
Ask someone with a child with a medical problem so rare that they're essentially unique what diagnosis is good for, and they'll tell you, because they're having to operate without it and it's hard. When there's a problem, information helps, and accurate diagnosis is a pathway to information.
If there's no problem, no need for a prognosis, no need for information about what medical or other management has worked for others with similar characteristics, and it doesn't seem like it would be useful if data from this person is collected and fed back to improve the system, then there's no need for diagnosis.
Diagnosis has also gained extra layers of function within society, especially in recent years and with certain conditions — it allows people to find others like them, feel part of a community, feel validated, etc. Sometimes people will want a diagnosis for those reasons. It's also used to attack others, or as an insult or a strategy against people. And it can be used for resource allocation. These secondary social functions make things more complicated, but if you focus on the clinical and research functions of medical diagnosis it will help you understand better than perseverating on ham sandwiches will.