It is actually derived from Judaism. Jewish tradition has avoided pronouncing or even writing the name of God out of holy respect and awe. They then used various other names for God. In Jewish tradition once one of the names for God have been written, since it refers to God, it cannot be erased or destroyed.
The bulk of Jewish legal opinion agrees that the law applies only to the written name of God when written in Hebrew and not when written in other languages, but out of devotion and respect many Jews have afforded the word “God” with the same level of respect as they would the Hebrew equivalents. By writing G-d, because it is not an actual term, it can be erased or the paper can be thrown away.
Many Christians have adopted this practice as a sign of respect.