Jewish custom.
The name of God is considered holy (the 2nd Commandment: Thou Shalt Not Take the Name of the Lord Thy God in Vain). Saying his name is, in essence, invoking His presence.
Thus is His name ‘censored’ in this regard, even ‘God’, which isn’t His true name.
The idea of writing G-d comes from the days before computers when the written word could be discarded, or temporary. If it was written out, and trashed, then it was considered a form of taking the lords name in vain. The word is sometimes replaced in conversation as well.