It is 255 because that allows for 256 values (0-255). Although it may seem random, 256 is actually a round number in computers because it is a power of 2 (2^8 to be exact).
But because 4 EVs make 1 stat point, you can't use all 255, that's why there are some left over. What you need to do is save those 3 EVs and put them towards something else.