In China, agricultural activities are a major source of greenhouse gas emissions, ranking second only to another significant source. This presents a significant obstacle to reducing emissions and jeopardizes both the availability of food and the sustainable growth of agriculture. It is primarily the farmers who utilize cultivated land and are thus accountable for the initiation of these emissions. Farmers' role is significant in adopting green and low-carbon (LC) agricultural production practices, and their actions are directly tied to the achievement of the dual goals of carbon reduction. Understanding their motivations for engaging in LC production and the factors that influence their willingness to do so is important for both theory and practice. In this study, data was collected from 260 questionnaires in 13 counties across five major cities in Shaanxi Province. The purpose was to identify factors that impact farmers' motivation and willingness to engage in LC agriculture using linear regression analysis. A structural equation model was constructed to better understand the underlying mechanisms that influence farmers' actions towards LC farming practices. The study's findings indicate that (1) farmers' behavior towards LC production practices is notably impacted by internal motivation based on joy and internal motivation based on responsibility (IMR); (2) IMR has the most pronounced effect on farmers' adoption of LC production practices; (3) the internal motivation based on joy, IMR, behavior attitude, subjective norm, and perceived behavior control are related to each other; and (4) the multi-group analysis of the data indicates that the impact of internal motivation based on joy and IMR on adopting sustainable farming practices may vary among different groups. It is essential to support farmers who have strong intrinsic motivation to engage in sustainable agriculture. Additionally, policymakers must promote positive attitudes towards sustainable farming to achieve the desired environmental (LC) objectives.