The oil viscosity is different for different engines, there is no universal formula that applies to every single engine ever made. - 10W30 oil will have a hot viscosity of approximately 10 cst at 100C. If this is an engine made after 1980s and was built with some respect to workmanship and is not a highly strung one then the manufacturer will have suggested it too.
Using a heavier oil will result in excess fuel consumption and also some startup wear as the oil will not be able to move quick enough.
Another reason to use "fancy shmancy 0W40" oils is due to the strict emmissions requirements which only full synthetics with strong add packs can fulfil. e.g. I can run my mercedes engine on straight 40 API CC diesel oil - it will start and work but the working life of the cats will reduce, the crank may experience fatigue as the engine starts.
In this case we use a "fancy" oil help the engine have a long life and also the emmissions parts to have a long life.