Heiji Hattori (服部 平次 Hattori Heiji?), also known as Harley Hartwell in the Funimation dub, is an Osakan high school detective in the manga and anime series Detective Conan. He is a childhood friend and the romantic interest of Kazuha Toyama. Originally a detective rival to Shinichi Kudo, Heiji has since found out Conan's true identity and the two often team up to work on cases. He was the first person to deduce Conan's true identity.
Heiji is a high school detective, and the son of Heizo Hattori, chief of the Osaka Police Department, and his wife Shizuka Hattori. Heiji wants to be a detective like his father since spending his childhood looking for lost cats in his neighborhood, and he is also very skilled in kendo and has become a favored tournament contender for his school.
At one time during their childhood, Heiji had had the unfortunate idea of locking himself and his friend Kazuha together with a set of old handcuffs which had no key to unlock it; as a result they involuntarily had to spend time together even on some rather intimate occasions (i.e., bathroom visits) before the cuffs could be removed. As a reminder of this 'closeness' and for good luck, Kazuha fashioned two identical lucky charms, each incorporating a chain link from the cuffs, which she and Heiji have been wearing ever since.
In the news, Heiji has been publicly declared the "Great Detective of the West", while Shinichi Kudo is the "Great Detective of the East". As a result, Heiji showed up unannounced at the Mouri Detective Agency looking for Kudo, seeking to challenge his rival to a showdown of wits. (In fact, they had such a contest before, three years previously, during a skiing trip in the Yamagata prefecture, although they never learned about each other's identities at that time. Heiji was soundly defeated in the following case after Conan Edogawa temporarily turned back into Shinichi, but he gained a lot of respect for Shinichi in the process.
During their second encounter, Conan knocked Heiji out to use him as the mouthpiece for the voice-changing bow-tie. But during his final presentation of the facts, Heiji awoke prematurely and discovered Conan's secret, and in the end managed to blackmail Conan into revealing all. Ever since that revelation, Heiji has been helping Conan in hiding his secret identity, though he constantly slips up by calling him "Kudo" in front of Ran and Kazuha.
Heiji and Conan most often congenially team up to solve assorted cases. Heiji has also helped Conan investigate the Black Organization on several occasions, such as when the two investigated Jodie Starling,or when Heiji investigated Eisuke Hondou on his own and then told Conan his findings. He has also helped cover for Conan during several of the brief instances where Conan regained his true adolescent age, and has even disguised himself as Shinichi on several occasions in order to protect his identity, even though he is not very good at it (mostly owing to his distinctive Kansai dialect). When not working on a case, he regularly attempts to invite Conan to take in the sights and culinary delights of Osaka, which he considers more wholesome than Tokyo's..