Background image shows in front of 3D objects, not behind them.
Using the compositor, the most basic setup to combine a 3D scene with an image (still or a video file) is mixing the movie clip and the render layers using an Alpha Over node.
The node sockets to which the images are connected determines the result:
The background image should be connected to the top socket
The foreground image or scene to the bottom socket.

The foreground's alpha channel is used to overlay the foreground on to the background.

If both images had an alpha channel, both alphas are combined for the final image.