In the context of China's dual carbon targets, reducing carbon emissions has become even more urgent and important. In order to reduce carbon emissions during the operation of a virtual power plant(VPP), a carbon market containing carbon emission allowances (CEA) and the Chinese certified voluntary emission reduction (CCER) project was introduced, and a VPP day-ahead and real-time coordinated scheduling optimization model was developed. This model was optimized to maximize benefits and minimize carbon emissions, further increasing the emphasis on carbon reduction from the VPP. The deep Q network (DQN) in the deep reinforcement learning (DRL) algorithm was introduced to solve for the complexity and non-linearity of the VPP model. Finally, to verify the validity and feasibility of the model and the solution algorithm, a VPP was chosen for the analysis of arithmetic examples. The results showed that: (1) In the calculation example, the VPP obtained more than 30 thousand yuan of carbon revenue per day by participating in carbon trading, which effectively mobilizes interest in carbon emission reduction. (2) Compared to the scheduling result with profit maximization as the goal, the scheduling result considering dual goals reduced carbon emissions by 32.7% at the cost of a 2.6% reduction in revenue, obtaining a better compromise. (3) The two-stage coordinated optimization model obtained 3.6% higher gains than the day-ahead optimization model that took into account deviation penalties. (4) By comparing the scheduling model solution results from the Yalmip toolbox and DQN algorithm, the effectiveness and feasibility of the DQN algorithm were verified.