気が合う means to get along with someone. Your 気 (spirit) does the action of 合う (to match). When your 気 matches someone else’s 気, the two of you get along. You are kindred spirits.
Examples of 気が合う
Further Reading
- Garrison, Jeff et al. Kodansha’s Dictionary of Basic Japanese Idioms, Kodansha, 2002, p. 206