Movies used to be shown continuously without a break between features.
If someone arrived late for a show they would simply sit and watch for where they came in before leaving.
To catch this crowd, and to signify an end to the film as well as chase as many people as possible from their seats for a new audience, coming attractions were spliced onto the end of the first showing as a “trailer,” even though it preceded the next screening.