Chemistry comes about due to five elements:
1. The leads are attractive in equal ways--they make a "handsome couple."
The leads don't have to be the same type of attractive--they don't even have to be attractive. Rather, chemistry is helped by physical compatibility.
In the college campus BL series Love by Chance and Chance to Love, the leads--Rathavit Kijworalak or Plan (Can) and Phiravich Attachitsataporn or Mean (Tin)--carry themselves in a similar way, both exuding a kind of compact sexiness. Phiravich is taller than Rathavit but tends to slouch. His lanky build and broad shoulders give him a smooth carriage. Rhathvit moves in a loose-limbed, confident way that also makes him a good mimic. They are both quite enjoyable to watch in motion.
Expression is an important addition here. In Bones, Emily Deschanel and David Boreanaz are rather exceptionally handsome people, yet their personas or auras almost entirely subordinate their looks. It is easy to forget they are good-looking people because they are so often being Bones and Booth, to the camera and with each other. Their personas match.
2. The leads match each other's energy within the same shot.
The leads don't have to have the same personality: one can be extroverted, one introverted. But there does need to be a sense that they occupy the same plane of existence. One isn't acting away while the other takes a break; one isn't overacting while the other comfortably fills a role.
In fact, equal greatness can help here, as with Cary Grant and Ingrid Bergman in Notorious. They are acting at the same level. (Besides, with so much sex appeal on the set, it is bound to spark!)
The relaxed goofiness of Gemini (Tinn in My School President) and the inherent reserve of Fourth (Gun in the same) translates to the screen, even though the actors often play characters who are the reverse of their real-life personalities. The on-screen personality clash is part of the plot. But the energy matches. (Interestingly enough, the director of My School President sent all the young men away on retreats before filming to achieve this "friendship on film" feel.)
Matching energy is an equally important aspect of sitcoms.
3. The leads are comfortable in their skins and with each other.
I've maintained for several years that actors who are good with babies are either parents or the oldest of several siblings.
The claim doesn't hold up. Nathan Fillion is not married, doesn't have kids, and is the younger of two. And he is fantastic with children on set!
My point, however, is that physical ease is not something that an actor can necessarily be "taught." There's a reason why certain couples--Ryan and Hanks, for instance--become popular, and it has nothing to do with whether they are dating each other in real life. On-screen, they appear comfortable in each other's presence--without any extraordinary "now I'm acting" effort.
I didn't expect to see it. The "bashful lover" is a common trope in manga and BL. Though the archetype can be sweetly done, I don't believe "bashful" is in Can's catalog of traits. ("Confused" and "naive," yes--not "bashful.")
Still, tropes are tropes and I expected to get bashfulness.
The scriptwriters did what I would have done! And I'm guessing one reason is that the actors have that physical ease.
4. The actors play off each other.
The twenty-first century version of Myrna Loy and William Powell, Emily Deschanel and David Boreanaz are quite amusing here. There's a reason many of the show previews included their banter in the car--which banter Angela refers to at one point as "hot."Speaking of cars, Rathavit Kijworalak (Can) and Phiravich Attachitsataporn (Tin) make another appearance. In Season 2, the characters meet up near Tin's car, which Can is using as a temporary desk for his backpack. Tin protests--the car is getting dirty. When Can belligerently queries, "What? Is this your car?" Tin holds up his key-fob. There is a beat. Then, he presses the alarm. Allowing for that beat is an indicator of actors who work well together. Plan playing Can not only doesn't speak over the pause but responds to it with a smirk and muttered "Oh, it's yours."Can, of course, then proceeds to rub his "dirty" self all over Tin's car. When Tin catches him by the shirt, Can pauses (again, a beat), grins, delivers a "ha-ha-gotcha" chuckle, and plasters himself against Tin, at which point, Tin turns into a bewildered--as opposed to masterful--Darcy who has absolutely no clue how to react next.
The exchange uses a great many BL tropes. It is unique due to the actors' ability to bounce lines and actions off each other, to--for instance--grin cheekily over a pile of food in response to a deadpan stare.
In a totally different genre, Ryan Stiles and Colin Mochrie had this ability in Whose Line Is It Anyway?
5. Je n'est sais quoi.
What viewers see is somewhat subjective. And good acting can negate the need for chemistry to an extent. But not entirely.
Good chemistry helps.