Here are some of the reasons that a typical EV3 robot might not drive straight and some suggestions.
Variations in the friction or other internal factors affecting performance of the motors. Try swapping over the motors or replacing them if you have spare
Carpet pile direction. Try running the robot in the opposite direction, or at right angles
Centre of balance / symmetry. Check for symmetry in terms of construction, weight, material, wheels, axis of rotation, and balance. Is there more friction on one side, and possibly slipping on the other?
Robot construction. Check that the wheels are well connected to the axis and frame, and that the beams and other bricks are firmly connected to each other.
Caster wheel not aligned, sticking. If there are free wheels in the back, make sure that both of them are placed in equal directions before starting the robot.
When starting the robot, try to make an even pressure on the start button, otherwise the robot may not start straight. Try putting a short wait time after pressing the button, so that the pressure of your finger doesn’t cause problems.
Motors have a small amount of internal gear slop (or backlash) between the encoders and the drive shaft that may affect initial trajectory.
Wheels or gears catching or rubbing more on one side than the other.
Different wheels might have slightly different circumferences.
Dust/dirt causing a loss of traction. Clean the tires and perhaps sweep the floor.
Try using brake, not coast, to finish a movement.