Because doctor-patient trust is
vital. If people are afraid to tell their health care providers anything important, then both individual health care outcomes and public health will suffer.
That you don't care if people know your medical history is great, but you shouldn't project that to other people.
Examples of things where people have entirely legitimate concerns about how others might react: sexually transmitted diseases, addictions, chronic diseases, contagious diseases, terminal conditions, mental health issues, pregnancy, failed pregnancy, abortion, and anything predictive of future health issues. And examples of people that they might not want finding things out: parents, children, pastors, church members, neighbors, insurance companies, current employers, tabloid journalists, future employers.