The Pm on the clock stands for post meridian. This is a Latin word and it means after midday. Its counterpart, called the am, stands for ante meridian, which stands for before midday. Hence, if it is 12 pm on the clock actually means that it is midday. 12 o clock in the afternoon may not be after midday, but it is regarded as the PM.
However, 12 am is the 12 o clock at night. Understanding the concept of the pm and am, relating to the midday, will help you to understand the time better and correctly associate the time on the clock with the time of the day.