Drug–drug interaction (DDI) prediction is one of the essential tasks in drug development to ensure public health and patient safety. Drug combinations with potentially severe DDIs have been verified to threaten the safety of patients critically, and it is therefore of great significance to develop effective computational algorithms for identifying potential DDIs in clinical trials. By modeling DDIs with a graph structure, recent attempts have been made to solve the prediction problem of DDIs by using advanced graph representation learning techniques. Still, their representational capacity is limited by isomorphic structures that are frequently observed in DDI networks. To address this problem, we propose a novel algorithm called DDIGIN to predict DDIs by incorporating a graph isomorphism network (GIN) such that more discriminative representations of drugs can thus be learned for improved performance. Given a DDI network, DDIGIN first initializes the representations of drugs with Node2Vec according to the topological structure and then optimizes these representations by propagating and aggregating the first-order neighboring information in an injective way. By doing so, more powerful representations can thus be learned for drugs with isomorphic structures. Last, DDIGIN estimates the interaction probability for pairwise drugs by multiplying their representations in an end-to-end manner. Experimental results demonstrate that DDIGIN outperforms several state-of-the-art algorithms on the ogbl-ddi (Acc = 0.8518, AUC = 0.8594, and AUPR = 0.9402) and DDInter datasets (Acc = 0.9763, AUC = 0.9772, and AUPR = 0.9868). In addition, our case study indicates that incorporating GIN enhances the expressive power of drug representations for improved performance of DDI prediction.