Ante- meaning “before”, meridium meaning “highest point of the sun” as in when the sun crosses the “meridian” which would be the line in which it is now setting instead of rising.
Passing from post-meridian to ante-meridian is exactly 12 hours from when the sun passed the meridian point, to keep it “consistent”.
I get though that it’s confusing, I questioned it a lot as a young boy.
Personally I believe that is stupid that we go from 11pm to 12am, but the reason is that the cutover is “12”, and everything after 12 (including the hour) are considered morning.
Like others have mentioned, we should really be using 24hr time these days where possible. Additionally I’m of the impression that we should use ISO8601 for date formats instead of what the Uk does (or even worse: what the US does).