Whether this is possible or not will depend on which airport Y is.
In MOST US airports, once you land and collect your bags you will be fully landside - in exactly the same area of the airport you would have been if you were an arriving passenger in that city.
In that case there's absolutely nothing stopping you from removing items from your luggage before re-checking your bags, or even dropping off an entire bag and re-checking less than you originally checked.
However in at least a few airports there are separate immigration/baggage collection areas for people that are connecting to a further flight which do NOT provide access to exit the airport after collecting your bags. For example, Washington Dulles airport has a separate "mid-field" immigration area that is used by some airlines. If your bag is tagged to a location beyond Washington then it will be sent to this area and you will need to collect it from there - and then immediately re-check it (and re-clear security) without any option to leave the airport.
Your only way to avoid this would be to ask the airline to "short check" your bag only to Washington, however most airlines will not do this now days.
This also presumes that both of your flights were purchased together. If they are on separate itineraries then your bags will only be checked to the gateway city, so they would go to the "non-connection" arrivals area.