In the Sherlock series, I noticed this peculiar thing which has been hinted at, many times. Sherlock is so weird. Almost no one like him and vice-versa but what makes John Watson so different? How come Sherlock starts to like him so much? Sherlock has hardly shown any emotion during the show except at those very few times when John is in danger. If it is not inappropriate I want to explore the chemistry between these two characters. What makes Watson and Sherlock such good friends?
Sherlock likes John because he appreciates him unlike others who call him a freak and ask him to piss off. In the episode A study in Pink, when John and Sherlock are in the cab the following conversation happens:
JOHN: That ... was amazing.
SHERLOCK: Do you think so?
JOHN: Of course it was. It was extraordinary; it was quite extraordinary.
SHERLOCK: That’s not what people normally say.
JOHN: What do people normally say?
SHERLOCK: ‘Piss off’!
John provides Sherlock a generalized opinion as to how a normal person would react to the given situation. During his best man speech Sherlock says,
Indeed, any reputation I have for mental acuity and sharpness comes, in truth, from the extraordinary contrast John so selflessly provides.
John also is his blogger. In the episode The Great Game Sherlock does mention, "I will be lost without my blogger". Apart from that, their affection does seem to become vivid in The Sign of Three where Sherlock confronts to John.
SHERLOCK: The point I’m trying to make is that I am the most unpleasant, rude, ignorant and all-round obnoxious arsehole that anyone could possibly have the misfortune to meet. I am dismissive of the virtuous ...unaware of the beautiful ... and uncomprehending in the face of the happy. So if I didn’t understand I was being asked to be best man, it is because I never expected to be anybody’s best friend. Certainly not the best friend of the bravest and kindest and wisest human being I have ever had the good fortune of knowing. John, I am a ridiculous man ...
For John liking Sherlock, here's a transcript reference from His Last Vow
JOHN (to Mary): What have I ever done ... hmm? ... my whole life ... to deserve you?
JOHN: Sherlock, I’ve told you ... (he walks towards him) ... shut up.
SHERLOCK (quietly): Oh, I mean it, seriously. Everything – everything you’ve ever done is what you did.
JOHN: Sherlock, one more word and you will not need morphine.
SHERLOCK (still softly): You were a doctor who went to war.
SHERLOCK: You’re a man who couldn't stay in the suburbs for more than a month without storming a crack den and beating up a junkie. Your best friend is a sociopath who solves crimes as an alternative to getting high. That’s me, by the way. Hello.
SHERLOCK: Even the landlady used to run a drug cartel.
MRS HUDSON: It was my husband’s cartel. I was just typing.
SHERLOCK (looking at her): And exotic dancing.
MRS HUDSON: Sherlock Holmes, if you’ve been YouTube-ing ...
SHERLOCK (louder, talking over her): John, you are addicted to a certain lifestyle. You’re abnormally attracted to dangerous situations and people ... (his voice becomes quieter again) ... so is it truly such a surprise that the woman you’ve fallen in love with conforms to that pattern?
To sum it up Sherlock and John need each other, whether they want to or not. Even when they are frustrated at each other, they always drift back together.
Source for transcript: Ariane DeVere
Sherlock likes Watson because Watson is useful, he accommodates Sherlock's habits and plays his part in things. For example Watson has no issue with Sherlock not speaking or eating for days and then suddenly demanding his full attention. In the books more than the series Watson is also clever, insightful and resourceful. Holmes notes in stories where he narrates himself that Watson continually plays down his role in their partnership.
Watson likes Holmes because he provides some physical excitement for Watson as well as intellectual challenges of the cases - he also likes to help people and these cases allow him to do that. Watson looking after Holmes when he drugs himself out of his mind due to boredom is another way he can help. The books are slightly less extreme than the series in this regard, Holmes has odd habits but Watson is also, primarily, a loner who appreciates alone time and does not want a housemate who constantly bugs him.
Watson is a doctor, and to be a doctor you must be smart. Sherlock needs someone clever to keep up with him. And genius needs an audience, so having someone mildly clever and tolerable is the best companion. Sherlock fulfills John's adrenaline addiction and John grounds Sherlock into reality, more easily guiding him safely through his cases. And this is a headcannon, but I think that Sherlock would hate hospitals, and John would treat his not life threatening injuries himself in Baker Street. Watson is strong, skilled, smart, determined, and loyal, and Sherlock is genius, flambouyant, show offy, flighty, and wild. They balance each other in ways that can be hard to describe. John also is the one who equally praises and scolds Sherlock, garnering him respect and affection, if extreme irritation as well.