Focus on the values in red outside the table (on the left and right sides). As the output increases by 4, the input increases by 1. This leads to the slope being rise/run = 4/1 = 4. The slope is the number just to the left of the x variable. So that's how they ended up with the equation y = 4x.
You can think of it as y = 4x+0, and note how it's in the form y = mx+b
m = 4 = slope
b = 0 = y intercept
The y intercept is the value of y when x = 0.
--------
Now because x = 0 and y = 0 pair up together, we can find the slope a different way: Pick any row other than the first row. Divide the y value over its paired x value. So let's say we pick on row two and we'd get a slope of y/x = 4/1 = 4.
Or we could pick on row three and get y/x = 8/2 = 4.
Picking on the fourth row gets us the slope to be y/x = 12/3 = 4. We end up with the same slope value each time. Again, this trick only works if (x,y) = (0,0) is on the line. Otherwise, you'll need to use the first method or use the slope formula.
For equations like this, we consider them a direct proportion. As x increases, so does y. As x increases by 1, y increases by 4. This is the same throughout the table.
----------
A real world example of this could be that x represents the number of sodas you buy, and if each soda is $4, then y = 4x represents the total cost of buying x number of sodas.
For instance, if you bought x = 10 sodas, then y = 4*x = 4*10 = 40 dollars is what you spend overall.