The iPhone 11 has two cameras because it is a dual camera phone. This means that there are two image sensors inside the phone, which allows for two different images to be taken at the same time. The main camera is used for taking photos, while the second camera is used for videography.
The advantages of having two cameras are that you can take advantage of both lenses to get different types of shots, and you can also use the second camera to record videos in 4K resolution. Additionally, having two cameras also gives you the ability to take portrait mode photos, where the background is blurred out and the subject is in focus.