The most comon terms would be 「脳内設定{のうないせってい}」 or 「マイ設定」.
「妄想{もうそう}」("delusion") is an old, "regular" word; It does not have the slangy feeling or vives that the two "special" terms above or the English "headcanon" have.
You could use 「妄想」 in explaining what a headcanon is, but it could not replace the term all by itself. The word is just too broad and 「想像{そうぞう}」("imagination") is even broader.