In the present study, the nanofluid flow and heat transfer in a shell and tube heat exchanger have been simulated in three dimensions. The hot fluid is the combustion gaseous product of a diesel engine, and the coolant is considered the shell of pure water, seawater, and CuO-water nanofluid with phi = 2 and 4%. The present study aims to reduce the temperature of exhaust gases from the heat exchanger, which is used at the inlet of the diesel engine gas recirculation system. The velocities of the hot gases and the coolant liquid based on Reynolds numbers, (respectively, Re-gas and Re-water), various fluids, and the volume fraction of the nanofluid (phi) are studied in this research. Moreover, the effect of twisted tape and baffle on the thermal performance of the heat exchanger is investigated. Examination of the base fluid shows that the change of the base fluid from pure water to seawater decreases the thermal efficiency of the heat exchanger by 3% and also increases the outlet gas temperature. Also, the pressure drop due to seawater is 16% higher than that of pure water. According to the results, the effect of twisted tape on improving thermal performance is higher than baffles. The analysis of thermal performance shows that the maximum convective heat transfer coefficient is obtained in the condition that the twisted tape with TR = 4 is used in the shell part, which is 119 W m(-2) K-1. According to the results, the use of nanoparticles in the base fluid with twisted tape, despite the increase in heat transfer, reduces the thermal performance. The use of nanoparticles in seawater also increases heat transfer; however, it considerably increases the friction factor.