I created a new page which is assigned a custom template. When I visit that page's url I see what appears to be the default page layout (not my template) and the admin toolbar shows options pertaining to media (ex: Edit media).

After some head scratching, I deduced that somehow that url must point to a media item. I edited the page slug and "bingo" the actual page appears just as expected. When I visit the original url (from the first slug) I see the same media item.

**Bottom line:** It appears that coincidentally the page and the media item share the same name, and this was somehow causing WP's wires to get crossed.

**My question:** Can someone help me understand how/why this happens? Does wordpress create magic permalinks to everything in the media library (*other than* their location in `wp-content/uploads/...`)? 

Note: The media item was uploaded normally into the media library (not FTP into the root directory, etc)