The temple was founded in 1282 by a Chinese Zen monk Mugaku Sōgen (1226-1286) at the request of the then ruler of Japan, the regent Hōjō Tokimune after he had repelled a Mongolian invasion in the period 1274 to 1281. Tokimune had a long-standing commitment to Zen and the temple was intended to honour those of both sides who died in the war, as well as serving as a centre from which the influence of Zen could be spread. According to the records of the time, when building work started a copy of the Sutra of Perfect Enlightenment (in Japanese, "engaku-kyō" 円覚経) was dug out of the hillside in a stone chest during the initial building works, giving its name to the temple.