The heterogeneity of method-level interactions, the high dynamics of container instances, and the scarcity of anomaly labels make anomaly detection in microservice systems difficult. Therefore, a dynamic graph and code execution context-aware microservice anomaly detection method (DGCEC-MAD) was proposed. Firstly, code information corresponding to service calls was collected through instrumentation techniques, including execution semantics such as class names, method names, parameters, and return values, which were encoded using a pre-trained sentence embedding model. Secondly, service calls were modeled as a continuous-time dynamic graph with timestamps and edge attributes; updatable node memories and a graph attention mechanism that fuses temporal and edge features were employed to capture the evolution of inter-service relations. Then, an improved link prediction task with dual negative sampling was designed to learn normal calling patterns purely from normal data and obtain high quality node representations. Finally, the learned representations were fused with KPIs, and anomalies were identified in an unsupervised manner via autoencoder reconstruction errors. Experiments on two microservice systems, including container-migration scenarios, demonstrate superior performance and robustness, with consistent gains over strong dynamic-graph baselines. Ablation studies further show that incorporating code execution context finely characterizes method-level behavior and significantly improves detection effectiveness.