WARNING: The following contains spoilers for Episode 1 of The Detective Is Already Dead, "Attention Passengers: Is There A Detective on Board," now streaming on Funimation.
The Detective Is Already Dead tells the tale of a hapless junior high schooler named Kimihiko Kimizuka, who one day finds himself reluctantly cast as the John Watson to world-class detective Siesta's Sherlock Holmes. Like Watson and Holmes, Kimihiko ends up bunking with his detective "employer" in the same apartment and accompanies her on every case she takes up. One of the cases Siesta investigates in Episode 1 of the anime is Toire no Hanako-san, or Bathroom Hanako, in English.
If the case name sounds familiar, that's because it is. Hanako-san is a well-known urban legend in Japan and has seen its fair share of media adaptations both inside and outside of the country. The concept of ghosts haunting public toilets in Japan is, in general, also nothing new. It's a type of urban legend that's been around since the 1930s at the earliest. In fact, the legend of Hanako-san originates from Aka Manto, another malevolent spirit known to haunt abandoned bathrooms that have old-fashioned squat toilets.
In the case of Aka Manto, a student will often feel an urge to use the toilet nearest to them, which ends up being a haunted one. The moment they notice a lack of toilet paper, they will then hear a voice that asks them if they want red or blue paper. The answer they choose determines their cause of death: if they choose red paper, they will be slashed to death, covering the entire area with blood. If they choose blue paper, they will be sucked dry of their blood until they're left looking blue.
Hanako-san is a variation of the Aka Manto legend believed to have originated during World War II. The story typically establishes Hanako-san as an elementary school girl who played hide-and-seek in a bathroom stall during an air raid and was subsequently killed. Since then, her spirit has been known to haunt the stalls (usually the first stall near the entrance) of an abandoned girl's bathroom on the third floor of a school. To summon Hanako-san, a student must visit a school bathroom between the hours of 1:00 to 3:00 AM and knock three times on each stall, asking if Hanako-san is there. If she is, she'll make her presence known. Whether she's a harmless or malevolent spirit is where the story varies.
In one version of the story, Hanako-san appears like an innocent little girl with burn scars wearing a red skirt. In another version, she appears as a three-headed lizard. In the most frightening version of the tale, Hanako-san emerges from the toilet and drags her victims down the toilet to the netherworld. The iteration of the urban legend The Detective Is Already Dead reinterprets in Episode 1 is a combination of the first version of the legend, in which Hanako-san appears as a little girl with a red skirt, and the version where she drags her victims down the toilet.
When Siesta decides to investigate the Hanako-san phenomenon taking place at Kimihiko's school, there are two details that are of particular interest to her: the fact that too many students are going missing in relation to the urban legend and the fact that female students "become Hanako-san" after an encounter with her. Siesta decides the best way to investigate the case is by going to the culture festival taking place at Kimihiko's school. This would give her the perfect excuse to investigate the bathrooms at the school and learn the honest truth about what's really happening to the students.
While investigating one of the stalls, Siesta discovers a piece of a drug packet. She later deduces that the real "Hanako-san" is a drug dealer distributing a powdered drug to students that have a reputation for elevating mood and improving concentration. The drug also has the additional side effect of impairing memory, which easily accounts for the strange behavior of some of the female students. The students going missing is actually due to them being drug addicts selling and buying the same drug on the streets.
In other words, there is no ghost lurking about the school, as Siesta explains to Kimihiko -- just a drug dealer exploiting a popular urban legend to cover up his own criminal activity.