
Blender Camera background image not rendered in Cycles
Before all, you need to [change film to transparent][film-transparent]. Render - Film, check the “transparent”.
First, go to the Compositing section, and check “Use nodes” at top left.
Access the Compositor and activate nodes for compositing by clicking the Use Nodes checkbox in the header
You will need Image node to pick the background image, and may also need Scale node to scale the fill the camera viewport.
And Alpha Over node, it’s in Color - Mix sub menu.
Then connect nodes as following image, you will make it.

Reference: