I could be wrong, but this sounds very similar to the problem explained in this thread: Competition code and user created tasks. Essentially, if you start your program before you plug in your controller, the program automatically runs your opcontrol function, which starts tasks that control different parts of the robot. Then, when you plug your controller into the field, it goes into the disabled state but does not end the tasks. When the autonomous starts, it tries to control parts of the robot that your opcontrol function was also trying to control, and this interference causes the autonomous to not work.
When you plug your controller into the field before you start the program, the program automatically goes into the disabled function instead of the opcontrol function, so it doesn’t start the tasks. Then, when the autonomous starts, since no tasks had already started, there’s nothing for it to interfere with, so it runs fine.