Yes, all proper computers will have a fan, actually three fans, inside it. One fan will be in the CPU, one in the GPU and one in the tower behind the power supply.
However, smartphones, washers, microwaves, cars and others that are not considered as a fully functioning computer will not have a fan but will have air vents to dissipate the heat generated by the CPU within.