Answer is
Yes, you can apply.
Next question is:
Will it be processed in US? No, it will be processed in your home/residence country. Not in your VISITING country USA.
Further,
Will it be approved?
Most probably No. Because IRCC will look into the reason why you are applying from USA not from home/residence country. VO think that you are a visitor in USA seeking entry to Canada for no good reason!