The population density of Italy 201/km2 is lower then population density of Germany 241/km2, so from point of view of density, Germany should have more high-speed rail than Italy.
But because cars are major German export driver and car manufacuring is major employment in Germany, anything competing with cars has not much political support.
https://www.dw.com/en/germany-merz-pledges-to-resist-2035-eu...
Density is not that important. It's the distribution. Japan for example has most of the population concentrated close to coast.
Italy has a few major population centers south of dome but sparsely populated otherwise.
And so on...
The population density of Italy 201/km2 is lower then population density of Germany 241/km2, so from point of view of density, Germany should have more high-speed rail than Italy.
That would be if kilometers of rail tracks scaled linearly with population density per unit area. My guess (based on no research at all) is it’s more that there’s a population density tipping point, and after reaching it rail development dramatically increases. I do also think you’re right about the influence of the German car industry.