People screw it up all of the time. It’s by convention/tradition that AM designates midnight and PM is noon. @zenvelo is right that AM denotes antemeridian/ante meridiem, and PM is post meridien, etc. Some picky people don’t like the use of antemeridianand insist on ante meridiem.
My guess is that when filling out a form it all has to be standardized and there wasn’t space for noon and midnight. Kind of like D.C. isn’t a state, but on some forms for Washington DC you enter the DC in the state section.
I use noon and midnight a lot of the time so there isn’t any confusion.
It’s easy for me to remember 12: midnight is 00 on the 24 hour clock, and so that’s how I remember 12 midnight is AM.