No one at the time doubted that God had given the Ten Commandments to His people, or thought they were something Moses dreamed up. The dramatic thunder and lightning that accompanied Moses' journey up Mt. Sinai reinforced their conviction that God was speaking to him (see Exodus 20:18). Jesus repeatedly taught that these commandments came from God, not man.
I can't help but wonder, however, why you're asking this question. Could it be that you secretly hope God didn't give the Ten Commandments to us -- and therefore you can ignore them and live any way you want to? If so, I urge you to stop and reconsider where this leads you. You may think it leads to freedom and happiness -- but some day you'll discover this is a lie, for it only leads to discontent and hopelessness. The Bible warns, "There is a way that seems right to a man, but in the end it leads to death" (Proverbs 14:12).
Why did God give us the Ten Commandments? (You can find them in Exodus 20:1-17.) He gave them to us for one reason: to make our lives better. God loves us; He loves us so much that He doesn't want us to destroy ourselves by ignoring His moral laws. But this is what happens when we turn our backs on Him.
God, however, showed His love for us in an even greater way: by sending His Son into the world to give His life for us. We have sinned and deserve only His judgment. But Christ took upon Himself the judgment we deserve, and when we put our faith and trust in Him, God forgives us and gives us the gift of eternal life. Don't reject Him, but by faith give your life to Him today.