If you want to factor, then you need to find two numbers that multiply to 4 and add to -5. Those two numbers are -4 and -1
-4 times -1 = 4
-4 plus -1 = -5
This means x^2-5x+4 factors to (x-4)(x-1). The order of the factors does not matter, as we can multiply in any order, so it is equivalent to (x-1)(x-4)
You can use the FOIL rule or the box method to expand out (x-4)(x-1) to get x^2-4x-1x+4 = x^2-5x+4 again. This confirms we have the proper factorization.