Click on the Cargo Train and click the “running” text. This stops the engine – Then tell it to reverse (to the right of that text) and then start it up again.
It should go towards the depot and let the passenger train get to the platform. Ideally you should keep depots on a siderail with a signal so that it waits for a clear path on the main railway (you’ll also need signals there of course)
(The signal being on the right side of the track so it triggers and halts the train when it wants to go out to the depot)