The D Layer is the lowest part of the ionosphere, and it matters a lot for AM radio.
ELI5 version
Think of the sky as having invisible layers.
In the daytime, sunlight “turns on” the D layer and it acts like a sponge for AM radio waves, soaking up a lot of the signal. That is why AM stations are often more local during the day.
At night, the D layer weakens a lot, so it stops soaking up as much AM energy. Then more signal can reach higher layers and bounce back down to Earth, which is why you can sometimes hear far-away AM stations after dark.