Anime about a guy who sees and then eats invisible bugs?
This sounds like an episode of Boogiepop Phantom.

Different episodes focused on different characters, each having a special ability... that was usually not as beneficial as it seemed. Their stories intertwined and showed the events from the different viewpoints of these characters. The guy who could eat bad memories was one of these episodes.