Every day of your life is split into 24 hour-long increments. Each of these hours can be counted, from the first one (hour 0) to the last one (hour 23).
The 24-hour clock is simply counting how many hours have been completed that day. Although the 24-hour clock is widely used in Britain, the U.S. military and various places around the world, North Americans and Australians are far more accustomed to the to its simpler, 12-hour cousin.
The 12-hour clock pivots at 12:00 noon, around the time when the sun is at its highest point in the sky. According to the 12-hour clock, everything in the day is either before noon (the morning), or after noon (cleverly named the afternoon).
By splitting the 24-hour clock in half, you are doing two counts: how many hours have elapsed before noon, and then how many hours have passed after noon.
In order to differentiate between these two 12-hour counts, we use the abbreviations a.m. and p.m. You would think that b.n. (before noon) and a.n. (after noon) would make more sense, however 17th-century Englishmen opted to use Latin instead.
In Latin, a.m. stands for ante meridian. Translated, this means before midday. The counterpart, p.m., stands for post meridian, which, you guessed it, translates to after midday.
To further clarify, it was decided that 00:00, the start of the day, would be known as 12:00 a.m., or midnight, and 12:00, high noon, would be known as 12:00 p.m. Though, to avoid confusion, many prefer to stick with 12:00 midnight or 12:00 noon.