Bearings and gears are important components in rotating machinery, and the diagnosis of faults in bearings and gears has always been an important topic. Currently, data-driven fault diagnosis is a better method. However, under actual working conditions, domain shift can easily occur due to different operating conditions, leading to difficulties in transfer learning and significantly reducing the diagnostic performance of the model. Re-labeling the fault types of the model is time-consuming and costly. To overcome these difficulties, a new unsupervised transfer learning framework based on the fusion of joint distribution and adversarial networks has been introduced for the fault diagnosis of bearings and gears in rotating machinery. The joint adaptation network learns the transfer network by aligning the joint distribution of multiple specific domain layers across domains, based on Joint Maximum Mean Discrepancy (JMMD) to achieve domain alignment. At the same time, the domain classifier in the adversarial network is used to minimize the domain classification loss as domain distribution difference to minimize domain shift. The fusion of these two methods achieves domain alignment, reduces model training time, and improves the accuracy and stability of the model. The experimental results demonstrate that the proposed model framework exhibits excellent performance in detecting and classifying different types of faults. The new model framework also demonstrates outstanding performance across various fault detection and classification tasks.