Ingrain is the standard spelling of the verb meaning to impress deeply. Engrain is an accepted variat, and it appears occasionally, but most dictionaries and usage guides recommend ingrain. This extends to the participle forms, ingrained and engrained; both words are listed in dictionaries, but some readers will consider engrained a misspelling.
Examples
For example, these major publications prefer ingrain:
The music is so ingrained in the Christmas routine that it can be hard to hear it amid the holiday hubbub. [NY Times]
But snow-readiness is as deeply ingrained in the national psyche as it is in the statutes. [The Guardian]
But being so deeply ingrained in the department he now leads has come at a cost, Beck said. [LA Times]Hamhuis and Keith Ballard . . . have yet to ingrain themselves into the Canucks’ game plan. [The Globe and Mail]
When it comes to the adjective version, engrained seems to be gaining ground in American publications—for example:
So engrained in the English psyche have the horrors of the Gabba become in recent years . . . [Wall Street Journal]
That’s a tough sell, because few things are more deeply engrained in human nature than the impulse to punish enemies. [NY Times]
Still, ingrained is far more common and is listed as the standard spelling all major dictionaries.