Is there any risk in applying for a different graduate program, while already doing a PhD?
In most cases it would be foolish to hide it from your advisor. But I don't know them or their personality. Some people would react very badly and others would be very supportive, with every possibility in between. For a vindictive person, you need to be extra cautious. But those folks are fairly rare. 

One issue you should consider is whether you are leaving others with problems to clean up after you go. If there is none of that, then people are more willing to be supportive since it is easier. But you may have control over when you go and the state in which you leave any joint research. 

The reason it is foolish is not just that the person might try to torpedo your career (possible - unlikely), but that they may have options for you that you haven't considered. Those options might involve X or Y or a melding. But they've been around longer than you and may have a much better idea about what is possible. 

But this is a sit down face to face sort of conversation. I wouldn't express it in terms of like and dislike, however, but that your recent studies are pushing you toward one thing rather than the other and you want to continue those explorations. 

Perhaps, knowing the situation, the advisor can make room for it to happen. If not, you can, perhaps, leave with good mutual feelings.