In drug development, drug-target affinity (DTA) prediction is a key indicator for assessing the drug's efficacy and safety. Despite significant progress in deep learning-based affinity prediction approaches in recent years, there are still limitations in capturing the complex interactions between drugs and target receptors. To address this issue, a dynamic heterogeneous graph prediction model, DynHeter-DTA, is proposed in this paper, which fully leverages the complex relationships between drug-drug, protein-protein, and drug-protein interactions, allowing the model to adaptively learn the optimal graph structures. Specifically, (1) in the data processing layer, to better utilize the similarities and interactions between drugs and proteins, the model dynamically adjusts the connection strengths between drug-drug, protein-protein, and drug-protein pairs, constructing a variable heterogeneous graph structure, which significantly improves the model's expressive power and generalization performance; (2) in the model design layer, considering that the quantity of protein nodes significantly exceeds that of drug nodes, an approach leveraging Graph Isomorphism Networks (GIN) and Self-Attention Graph Pooling (SAGPooling) is proposed to enhance prediction efficiency and accuracy. Comprehensive experiments on the Davis, KIBA, and Human public datasets demonstrate that DynHeter-DTA exceeds the performance of previous models in drug-target interaction forecasting, providing an innovative solution for drug-target affinity prediction.