Not all altars that the people built were God's altars. They could build their altar to Him, but He didn't direct them to do it every time they built one.
In the Old Testament, God told them to destroy those altars and to build His altars. The people were to cut down the grove and burn the trees where those altars were built ... and the heat from this burning was used to burn God's sacrifice.
Altars were used for different kinds of sacrifices ... burnt offerings, peace offerings, and incense offerings ... to name a few.
God told the priests exactly how to build His altars and where to build them. Some altars were in the temple, some just outside the temple, and some were to be built completely away from the temple area.
The administrator of the altars was the high priest.
Reverend Robert W. & Mary C. Butler