Offline
An interesting topic and it is true that it is tricky to see why some work and others don't. For me I think it comes down to, as some others have said, the honesty that one actor has towards the other in their portrayal of their character. A good actor doesn't pretend to be someone else on stage or screen, rather, they are that someone else. When both actors (sometimes more than two actually) hit the sweet spot then the dynamic and connection is a very real one. Lack of chemistry for me is when either one, or both, are not able to reach this depth of their character and the emotions that would drive.
I would also say that a good director can get a connection, a chemistry, between characters that a poor director may actually destroy. Often this is due to the director not creating a safe environment for the actors and their work.
Also, an experienced and very capable actor can enable those they work with to reach new levels in both their performances and their on-screen presence and chemistry. On screen chemistry is a two-way 'conversation'.