Dr. Wily always realized that his evil plots might someday come to an end at the hands of Mega Man. To prepare for such a possibility, he constructed some backup robots and sealed them away in special compartments. If six months ever passed without Dr. Wily's input, the robots would be activated so they could search for their master.
In the closing of Mega Man 6 Dr. Wily was indeed captured by Mega Man and sentenced to jail. His attempts to escape failed, so he waited. After six months, his stored robots began to rampage the city, looking for their creator. Mega Man hurried to stop this sudden and unexpected siege. He encountered Bass and Treble along the way--a humanoid robot and his robot dog--two mysterious robots who were apparently attempting to stop Dr. Wily's forces just as Mega Man was.
Then Mega Man found Dr. Light just in time for the two to watch Dr. Wily escape from prison. The chase was on.