気が遠くなる means to become lightheaded, to feel faint, or to be overwhelmed. Your 気 (spirit) does the action of 遠くなる (to become distant) from you. It can also mean to faint or pass out.
Examples
Further Reading
- Garrison, Jeff et al. Kodansha’s Dictionary of Basic Japanese Idioms, Kodansha, 2002, p. 245