Your Legal Rights, an online legal information site run by Community Legal Education Ontario (CLEO) and funded by the Law Foundation of Ontario, answers this question.
In most cases, someone stopped by the police does not have to answer questions. Being polite is a good idea. So is telling them who you are. This could prevent being detained because of mistaken identity, or being held for a show-cause hearing. Giving police a false name could lead to a charge of obstructing justice, or obstructing police.
Like drivers of other vehicles, bicyclists can be stopped if an officer thinks provincial or municipal traffic laws have been broken. Cyclists must stop and provide their name and address. Refusal is grounds for arrest.
While there is no general requirement to carry ID, there are situations in which it is mandatory. For instance, drivers must carry a valid licence when driving a motor vehicle.
“Common Questions” are available at the Your Legal Rights site.