If you want to plot a histogram with a normal distribution on top, this is one of the easier ways:
library(ggplot2)
df <- data.frame(
x = rnorm(100, mean = 50, sd = 5)
)
ggplot(df, aes(x)) +
geom_histogram(aes(y = stat(density))) +
stat_function(fun = dnorm, args = list(mean = mean(df$x), sd = sd(df$x)))
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Created on 2020-05-26 by the reprex package (v0.3.0)
If you want to keep the y-axis in count units, you'd have to wrap the dnorm function and scale it by the binwidth and number of observations:
wrap_dnorm <- function(x, mean = 0, sd = 1, binwidth = 1, count = 1) {
dnorm(x, mean = mean, sd = sd) * binwidth * count
}
ggplot(df, aes(x)) +
geom_histogram(binwidth = 1) +
stat_function(fun = wrap_dnorm,
args = list(mean = mean(df$x), sd = sd(df$x),
binwidth = 1, count = nrow(df)))