Usually you can do this by overriding aesthetics in guides(), but the alpha transparency seems to only affect the confidence bars - so I'm not sure there is a simple way to do it, but this works:
library(ggplot2)
library(palmerpenguins)
ggplot(penguins, aes(bill_length_mm, body_mass_g, color = species)) +
geom_smooth(alpha = 0.3, size = 0) +
stat_smooth(geom = "line", alpha = 0.3) +
scale_color_manual(values = c("red", "blue", "green"))
