It is an old story but a very funny one.
It is not illegal, but the Bank of Canada says:
“…However, there are important reasons why it should not be done. Writing on a bank note may interfere with the security features and reduces its lifespan. Markings on a note may also prevent it from being accepted in a transaction. Furthermore, the Bank of Canada feels that writing and markings on bank notes are inappropriate as they are a symbol of our country and a source of national pride.”