ssandy, if for example you are from the Philippines and you overstay your visitors visa in US and you plan to apply to Canada, your application can be processed in US provided you have a valid one year stay here in US. If you dont have one, you can still apply but the office that will process your application will be the one from your country of origin, which is the Philippines. You dont need to go back to the Philippines to process your application, you can process it here, meaning you provide all the requirements/documentation needed while you are here. The only time you need to go back to the Philippines is when you are called for an interview. There are a lot of reasons why a particular applicant is being called for an interview.
So make sure from the start, that your application are all in order, well documented.