The basic story of The Ten Commandments is this:
The Israelites had been wandering the desert for years and were beginning to lose faith in the promises of God. Moses was called into God’s presence on the top of Mount Sinai, and there he was told the Ten Commandments and he wrote them on two tablets of stone. However, when Moses came down from the mountain to deliver the Commandments to the people, he saw they had made altars to idols in his absence. In his outrage, Moses threw down the tablets and broke them. He later returned to the mountain, and again God visited Moses and the laws were re-written.
The passages about the Ten Commandments are found in both Exodus 19 through 20 and Deuteronomy 4-6. Here are some links to a reliable online Bible so you can check it out!