Look into parallax background. This will give you an infinite background.
To make the map infinite takes more work. You can use TileMaps. This is like the kind of levels from the original Mario game. You can create 2 TileMaps next to each other, and when the player gets to a certain point, you move the one in the far side to the near side (adjacent to the one on the screen). This gives you a fake infinite map. Or you could do things totally random or procedural.