Answer :
Moses went up onto a mountain to speak with God. Moses' people were worshiping idols and God didn't like this. God gave Moses two tablets of rules, which were the Ten Commandments.
The 10 commandments were told to Moses by god. Moses wrote down the commandments in Exodus 20.