Temple is originally a place to worship ancestors, that is, ancestral temple. The places where superstitious people worship gods are also called temples, such as the Dragon King Temple and the Earth Temple. In the era of feudal society, so-called virtuous and talented people could also build temples to worship them, such as Guandi Temple and Yue Temple. In addition, the place where the emperor handled political affairs was called a temple. The original meaning was an official office, such as the Yushi Mansion in the Han Dynasty, also known as the Yushi Dafu Temple. Temple also refers to central institutions, such as Taichang Temple and Dali Temple. At the end of the Han Dynasty, Buddhism was introduced to China. Since then, temples have also referred to temples (where monks live).
You can also say this now: "Temple is a place for foreign religions to be preached. Temple is a place where descendants of Yan and Huang in the past dynasties commemorate national mourning, loyalty, filial piety and other people. What is enshrined in the temple is Buddha, and what is enshrined in the temple is God. It's the idolization of people."