Yes. It is a sin.
Exodus 20:7 (NIV), “You shall not misuse the name of the LORD your God, for the LORD will not hold anyone guiltless who misuses his name.” God is the supreme being in the universe. He has infinite wisdom, power, and love. His very throne is justice. Should we not be in awe of Him? and reverence Him? Part of reverencing God is only using His name in a holy manner.
Jesus taught us to pray, “Our Father, which art in heaven, hallowed be thy name.” Matthew 6:9 The New Living Version of the Bible translates the same scripture, “Our Father in heaven, may your name be kept holy.”
When something is holy, it is to be used only in holy settings. For example, the gold cups and plates in Solomon’s temple were to be kept within the temple and used only in specific, holy services. These cups and plates were never to be used to eat and to drink from in daily meals.
Likewise, God’s very name is holy. We may use His name in prayer, in worship songs, in conversations about God and His truths. But to use God’s name casually, as in the expression, “Oh my God,” is a misuse of God’s name.