The short answer is that Baymax doesn't need the discs to function, they appear to simply be backups with various information on them that's not part of his core programming, in this case 'health care data' on the green disc and 'karate data' on the red disc.
When Hiro removes Baymax' health care disc (before attacking the professor), Baymax says
"Hiro, this is not what...."
before his disc is reinserted. This shows that he can quite happily speak and move without either of the discs in place.
It stands to reason that Baymax simply copied his personality and experiences over to the green disc when Hiro wasn't looking and also presumably discarded the red disc at the same time.