After Solomon died his kingdom was split in two. Ten tribes seceded and made Jeroboam their king; two accepted Solomon’s son Rehoboam as their king. God’s temple was part of Rehoboam’s kingdom and Jeroboam was afraid that if his subjects continued to go there to worship they might not remain loyal to him.
And Jeroboam said in his heart, “Now the kingdom will turn back to the house of David. If this people go up to offer sacrifices in the temple of the LORD at Jerusalem, then the heart of this people will turn again to their lord, to Rehoboam king of Judah, and they will kill me and return to Rehoboam king of Judah.”
So the king took counsel and made two calves of gold. And he said to the people, “You have gone up to Jerusalem long enough. Behold your gods, O Israel, who brought you up out of the land of Egypt.”
And he set one in Bethel, and the other he put in Dan.
1 Kings 12:26-29