If one has a history with mental health issues such as depression or anxiety will it hurt their chances of getting into a competitive school?
It might. If it is mentioned, it needs to be addressed by a counselor at school, rather than you. I would only ask a guidance counselor to discuss it in the event that an explanation for poor grades is needed. Other than that, I do not see a reason to fill anyone in on your medical issues. Mental health is a medical issue.
If it has affected your academic performance, I would actually mention it so they can understand your grades in the context of this condition.
Would schools have any way of seeing one’s medical records and would lack of mention of any mental health issues harm the chances?
Schools have zero access to your medical records (HIPAA rules prevent this information from being given to anyone without your express permission in writing), so if you don’t want to mention it, you don’t have to and they will never know. If there are gaps in your education and/or low grades which require some context and explanation, it’s probably best to address it in the “additional info” section. Make sure that you’re clear with any teacher or guidance counselor who may write a recommendation as to whether you’re okay with it being mentioned or not, too.