First of all we must specify the reason of the initial impossibility of connecting the devices: starting from the cables and the relative "hooks" we will notice that they are not absolutely compatible with each other.
As you can see, therefore, there are different types of cables. The first two, VGA and DVI are the cables a bit of "prehistory" that is the cables of many years ago. In fact, for about fifteen years (perhaps even more), HDMI and, recently, DisplayPorts have landed on the market.
The difference lies in the fact that the first (vga) only supports analog signals without audio, the second (dvi) has a digital flow and also supports audio but only if the video card allows it ... while the other two digital signals therefore better video quality and above all the possibility to transfer audio too! The difference between hdmi and displayport is that the latter is only recommended for high resolution devices (8K and so on ...)