A machine for producing products such as ice cream, frozen beverages or granita comprises a product container which is provided with a tap for dispensing the product. A cylinder with a substantially horizontal axis, which forms the evaporator of a refrigerating circuit of the machine for cooling the product in the container, projects from a rear wall into the container. A mixer element is present around the cylinder and rotates coaxially with the axis of the cylinder by means of a motor unit connected to the mixer element by means of a drive shaft which passes along the axis of the cylinder and which is connected to the mixer element at one end of the cylinder which is opposite to the said rear wall. The motor unit is at least partially housed inside the cylinder through the said rear wall, so as to reduce the overall dimensions of the machine.