What's the difference here - why we use am in one example, and an der in the other?
The declination of "der" and "die" in the case of a Dative case.
"An der" and "Am" are actually Dative (location).
"Am" is, as other mentioned, a composition of "An dem"
So in the masculine case,
the Dative of "der" is "dem"
and in the feminine case, the Dative of "die" is "der" (which is the same article as the masculine nominative)
Sorry, confusing but just the way it is.