In short: It may not be saturated fat by itself but high saturated/unsaturated fat ratio and high animal/plant fat ratio in the diet that increases the risk of heart disease.
A systematic review of the effect of dietary saturated and polyunsaturated fat on heart disease (NMCD Journal, 2017)
Reducing saturated fat and replacing it with carbohydrate will not
lower cardiovascular events or CVD mortality although it will reduce
total mortality. Replacing saturated fat with mono- or
poly-unsaturated fats or high-quality carbohydrate [from whole-grain
food] will lower cardiovascular events.
Saturated Fatty Acids and Cardiovascular Disease: Replacements for Saturated Fat to Reduce Cardiovascular Risk (PubMed, 2017)
Replacing dairy fat with carbohydrates from refined starches and added
sugar was not associated with increased or decreased risk of coronary
heart disease (CHD), stroke or total cardiovascular disease (CVD).
However, replacing dairy fat with carbohydrate from whole grains
reduced the risk of CVD, CHD and stroke. Relative to other animal
fats, dairy was found to have less impact on CVD. When 5% of energy
from dairy fat was replaced with animal fat from non-dairy sources,
risk of CHD increased by 6%. However, when 5% of energy from dairy fat
was replaced with an isocaloric amount of polyunsaturated fats, risk
of CHD was reduced by 26% and CVD risk was reduced by 24% .
A basic explanation of the underlying mechanisms:
The liver produces low-density lipoproteins (LDL) and high-density lipoproteins (HDL). Lipoproteins are composed of triglycerids, phospholipids, cholesterol and proteins.
LDL caries cholesterol from the liver to the peripherial tissue, including arterial walls, where it can accumulate and cause atherosclerosis. This is why LDL is called "bad cholesterol" (even if LDL is only a carrier for cholesterol). HDL clears excessive cholesterol from the blood and carries it to the liver for disposal, so it is called "good cholesterol. (Heart.org.uk)"
High LDL levels are associated with an increased risk of coronary heart disease (Bentham Open).
One possible mechanism by which saturated fats increase (LDL) cholesterol (PLOS):
Saturated fat is thought to increase LDL-C primarily through
down-regulation of hepatic LDL receptor activity, leading to reduced
clearance of LDL particles [from the blood].