Gasoline atomizes better and it’s flash point is more conducive to proper ignition. And gasoline was a waste product before cars were invented, when kerosene was needed for lamp oil. Heavy oil sets up like peanut butter in cold conditions, which makes it not useful for compression ignition engines, like Diesels, which use an anti-gel ingredient to keep the fuel flowing when it’s cold.
Diesel engines came along in the mid 1910’s when Diesel was trying to make a compression engine that ran on coal dust. (The first such engine exploded.) It was thought that German agents had him killed during WWI.
Also, a compression ignition engine needs very high compression to ignite the fuel, like about 22:1. And a Diesel engine will run on motor oil. Or gear oil, or vegetable oil, or automatic transmission oil,... Just about any kind as long as it flows and isn’t like peanut butter or regular grease lubricant.