How is it possible to edit trac so a new ticket with component X
follows workflow X
and component Y
follows workflow Y
Trac doesn't give you a way to do that at the moment. It assumes that your project has a single workflow.
There are some plugins that will give you additional workflow capabilities, however. The AdvancedTicketWorkflow Plugin gives you some advanced commands to use when designing your workflow. See the documentation for the "triage" command for an example of how to route two types of tickets through two slightly different workflows.
The TypedTicketWorkflow Plugin also adds additional workflow capabilities, by allowing you to create actions that are only applicable to certain ticket types.
There are a number of additional workflow-related plugins that you might want to test out. Some of them look like they haven't been updated in a while, though, so be aware that you may run into compatibility issues.