antigens are foreign proteins against which the immune system forms antibodies. It is not a gene in the traditional sense. The word 'antigen' derives not from 'Genetics' but from English'antibody geneerating '(= antibody producing).
What the receptors of the antibodies record as an antigen is the surface structure of the proteins. Each antibody usually fits only to a specific antigen, also known under the technical term of the key-lock principle. On the picture on the left is a pending Antigen-antibody reaction displayed. The other antigens in the vicinity of the antibody can not dock, their structure does not match that of the antibody.
Normally the immune system only makes antibodies against foreign protein structures. Because before the antibodies are 'matured', they get in contact with the body's own proteins. This leads to a development of tolerance, so that a fight against your own body cells is impossible. However, in the case of autoimmune diseases, the immune system incorrectly recognizes the body's own cells as an antigen and produces antibodies. As a result, the immune system is fighting against its own body. The example also shows that theoretically any structure can act as an antigen.