Adenine and Guanine are bothe purines. Purine-purine pairings are energetically unfavorable, since moelcules are too close to each othet. (This is the other way round for pyrimidines, they are too apart for stable bonding). Therefore because of this reason Adenine can't bond with Guanine. This is the first factor.
Adenine has only two hydrogen bonding sites whereas Cytosine has three hydrogen bonds. Therefore an Adenine-Cytosine paring is not energetically favorable. It can only bond with a base with two hydrogen sites. This is the second factor.
The only base that Adenine pairs with is Thymine which is a pyrimidine and has only two hydrogen bonding sites. Thus AT and GC paring rule comes into existence.