The LED is now changing colors as per code, how to stop the code which makes the LED change colors?
Upload a different program that doesn't do that.
Embedded programs don't exit. There is nowhere for them to exit to. They run until you turn the electricity off.
You could have a timer or an external event such as a button press cause a different main loop to be executed, or set a flag that causes the single main to do something different e.g. skip the LED colour change. But it will still be looping forever.
There can be a way to make the CPU go into a low power mode that doesn't run instructions, but that is more advanced topic, and you always have to be prepared for it to wake up again.
I unplug re plug the UNO and it still runs the code
That is usually the desired behaviour for devices with embedded microcontrollers.