Its mentioned in Goodfellas so this is obviously a thing among Italian families and their cooking.
Do you stir to prevent it from sticking? Why cook the sauce for so long?
To cook a sauce for a long time, particularly without a lid, concentrates the flavor of the sauce as the water evaporates. That's also called reduction. Yes, sauces that are cooked that way need to be stirred frequently to avoid allowing them to stick to the bottom of the pan. Sticking is bad enough, but it leads to burning, which is worse.
In meat sauces (sauces that include meat), long cooking can also contribute to tenderness of the meat and allow the meat flavor to permeate the sauce as the long cooking breaks down the collagen in the meat.
Not all Italian sauces are cooked for a long period of time; not even all tomato based sauces are cooked for a long time.
There are several classes of sauce that benefit from long cooking times:
Thick hearty tomato sauce, especially when made from fresh tomatoes. A cooking time of several hours helps the tomato break down into a sauce like consistency, and the water lost (reduced) during cooking helps intensify the flavor, since tomatoes can have a great deal of moisture. These sauces are rarely looked all day, but rather several hours.
Meat ragus and similar, where slow cooking meat cuts (like meatballs, bracciole, chuck, short ribs, pork shoulder chops, veal shanks, oxtails, and similar) are slowly braised in the base sauce. The long, slow extended cooking is actually for the benefit of the meat, as it becomes tender and succulent. This is the basis of the "Sunday Gravy" common in many Italian-American households. In Italy, the meat would often be pulled out of the sauce and served as a separate dish from the sauce itself.
Stocks and broths, which will be used as the basis for future soups, sauces, and other dishes can benefit (and usually take no harm) from very extended cooking times. During the long cooking, more flavor and richness (from gelatin) is extracted into the liquid, and reduction (if additional water is not added to replace water lost to evaporation) helps intensify the flavor. Stock normally has sufficient circulation from thermal convection that stirring is not required.
The main purpose of the stirring is to help even out the cooking, and prevent the sauce on the bottom from overcooking or burning while the rest is undone. Many cooks, myself included, prefer to put the whole pot in the oven when making a braise which does not require reduction, as the gentler surrounding heat is not likely to burn the dish, and so stirring is not required.
When it comes to intense flavor of acid-based, tomato sauces, you can choose ingredients. Avoid long cooking times (unless you use fresh tomatoes) by just using the best prepared, unsalted sauce or paste... adding spices and ingredients during cooking.
The most important technique to infuse flavor from the added spices, is cooling it quickly and storing it, overnight, at least two days is optimal. Salt must always be added at the end of the process, as it will impede cooking.