The two hit it off immediately as if they were old friends.
Tips
usage
投机 has two distinct meanings: (1) financial speculation or opportunism (negative), and (2) hitting it off with someone (positive). Context determines which.
memory
投 (throw) + 机 (opportunity) = throwing yourself at opportunities. Negative: opportunism. Positive: finding the right moment to connect.