An X-ray imaging apparatus automatically distinguishes between right and left breasts during mammography. The X-ray imaging apparatus includes: an X-ray assembly configured to press a breast, irradiate X-rays onto the pressed breast, and detect X-rays transmitted through the breast two handles respectively provided in both sides of the X-ray assembly so that a patient is able to grip the handles, each handle including a sensor for detecting the patients grip and a controller configured to determine a position of a handle including the sensor that has detected the patients grip, and to determine that a breast subject to mammography is a breast corresponding to the determined position.