So, the story goes that French conceptual artist Pierre Bismuth was tired of his friend always complaining about her boyfriend, so he asked her if she would erase him from her memory if she could. She responded that she would, and this got Bismuth thinking about what the consequences of such a drastic action would be if it were possible (source).
Pierre mentioned this idea to a friend, Michel Gondry, who was also captivated by the idea. Gondry then got in touch with writer and director Charlie Kaufman, who started to bring the story to life. Kaufman got his start in comedy, writing for National Lampoon magazine before transitioning to television and eventually the big screen. (His debut was Spike Jonze's acclaimed Being John Malkovich, a movie similar to Eternal Sunshine in its strange perspective and the whole entering-the-mind thing.)
Kaufman's first collaboration with Gondry, the film's director, was a film called Adaptation, which was actually about Kaufman and his fictional (although accredited) twin brother trying to understand the book that the movie is supposed to be an adaptation of.
Anyway, yeah, Kaufman is a little weird (and we haven't even mentioned his directorial debut, Synecdoche, New York), but he totally won the Academy Award for Best Original Screenplay for Eternal Sunshine—so weird can definitely be good.