I wonder, what are you expecting? You are specifying the absolute number of pixels (
units = "px") and getting an image output with exactly this number of pixels:
ggplot() + stat_function(fun = dnorm, n = 50, color = "orange")
ggsave("Figure1.jpg", dpi = 300, width = 2500, height = 1500, units = "px")
ggsave("Figure1b.jpg", dpi = 150, width = 2500, height = 1500, units = "px")
Figure1 and Figure1b will have exactly the same number of pixels.
Specify a desired print output size in e.g. cm or inches and the dpi setting will be used to determine the required number of pixels to achieve this pixel density in the output once it is printed in that size. So Figure 2b will have double the number of pixels than Figure2:
ggsave("Figure2.jpg", dpi = 300, width = 25, height = 10, units = "cm")
ggsave("Figure2b.jpg", dpi = 150, width = 25, height = 10, units = "cm")
But a .jpg has no print size associated with it - just the number of pixels. You can print it at any size, but the pixel density will of course vary. 96dpi are the default in Windows.