I want to lower the gearing in a GRX 800 set up from a single 40 ring to a single 32 ring or use a XT M8000 crank with 32 ring.Im old and slow.Will it work
A single ring is quite easy because there is no front derailleur to worry about.
I assume you have FC-RX810-1, which has 110mm BCD, and uses the same chainrings as FC-RX600-1
There are some Chinese 34t chainrings as well
If you want to swap a XT crank you can but you will need to remove (or replace) your BB and fit 3x 2.5mm spacers https://si.shimano.com/api/publish/storage/pdf/en/dm/MBFC001/DM-MBFC001-01-ENG.pdf
Then your XT crankset will have slightly (0.23cm) wider chainline and substantially (2cm) wider q-factor
They are not drop-in replacements for each other because M8000 is a mountain crank and GRX is road, at least in terms of the spindle length and chainline.
The non-boost M8000 cranks (FC-M8000-1) have 50.4mm chainline and the 1x 800-level GRX cranks (FC-RX810-1) have 49.7. That's close enough that you wouldn't usually find a meaningful difference, but it is within possibility with short enough chainstays.
In all cases you could get a bottom bracket to install FC-M8000-1 in place of what you have, but which bottom bracket that would be depends on your shell type. If you have BB86, I don't think there's a better solution available than to just use spindle spacers outside the bearings.
The boost variants of M8000 will push out the chainline enough to cause issues in most cases, so shouldn't be seen as compatible.
The chainline is a concern. The GRX 1x crank has a chainline of 49.7mm. The M8000 1x crankset, because it's designed for mountain bikes which use Boost spacing, has a chainline of 53.4mm. That means that the MTB crankset's chainring will be 3.7mm further outboard than on the GRX. This means that in your lower gears, you will be more cross chained. This will increase the amount of noise you produce and it will cause faster wear, plus increase the amount of drivetrain friction.
I believe you also will need spacers for your bottom bracket, as MTB BBs are more widely spaced than drop bar frames - without spacers, you would have some of the axle unsupported and there would be a lot of play in the system. Another possible concern is the Q-factor, i.e. the stance width. This doesn't apply to all riders, but if you are a roadie who prefers relatively narrow stance widths, then the MTB Q-factors are considerably wider. Nevertheless, many folks do frequently switch from road bikes to MTBs, and we don't see MTB riders getting spates of injuries from their wider cranks.
While it would only be a 2t chainring difference, Wolf Tooth makes a 38t chainring for GRX 1x systems. They are unfortunately out of stock right now, but there should be other aftermarket component manufacturers. (As per @thelawnet's answer, Wolf Tooth does list 36t 1x rings for Shimano road cranksets, and I'm not sure if there is any issue with GRX compatibility. The BCD should be identical.)
On the off chance that this is a GRX Di2 setup, I know that it is compatible with an XT MTB Di2 rear derailleur (what you can't do is mix road Di2 levers a road front derailleur with an MTB rear derailleur, both derailleurs have to be MTB or road), which would let you put an MTB cassette on there (e.g. 11-46). Or, for mechanical RDs, you can get a different Wolf Tooth product called the Tanpan, which lets you use a mechanical MTB RD with your GRX shifters. That should get you compatibility with an 11-46 cassette. Also, because Shimano's specs are conservative, you can likely use a 11-42 cassette with your existing setup; in conjunction with a slightly smaller chainring, that might provide low enough gearing.
This paragraph is more of an editorial. I believe that Shimano has admitted to being well behind SRAM in the shift to 1x drivetrains on MTBs, and I think many would agree that they are behind on gravel bikes as well. It is clear that their 1x gearing ranges are more limited than SRAM's 11s and 12s 1x groups. Unfortunately, this question does highlight some of the gearing limits with Shimano's 1x groups.