The Anfu Confucius Temple was built in the fourth year of Yuanfeng in the Northern Song Dynasty (1010 AD). Just over 100 years later, the new county magistrate believed that the scale of the Confucius Temple was too small and the layout was not standardized, so it was demolished and rebuilt in the 13th year of Shaoxing in the Southern Song Dynasty. When the Yuan army invaded Anfu in the south, the Confucius Temple was destroyed by fire. In the Ming Dynasty, the emperor decreed a unified architectural format for Confucius temples all over the world. In the 16th year of Zhengde in the Ming Dynasty (AD 1521), Yu Kui, the magistrate, rebuilt them according to the format unified by the imperial court. Although it underwent several major repairs during the Ming and Qing Dynasties, its main building still maintained the regulations of the Ming Dynasty. In 2012, Anfu Confucius Temple was included in the seventh batch of national key cultural relics protection units announced by the State Council. Anfu Confucius Temple was promoted from a provincial protection unit to a national key cultural relics protection unit.