What's the difference between Shimano HG and SRAM XD free hubs?
SRAM's XD and XDR drivers (their term) don't have splines, unlike Shimano and Campagnolo freehub bodies. Instead, their cassettes screw onto the threaded section of the driver as shown in the image below.

They did this to

Address the shortcomings of Shimano's Hyperglide (HG) freehub, namely that the small splines got chewed up
Because they wanted to implement cassettes with 10t small cogs, so they needed a shorter freehub body anyway. The diameter of those cogs is smaller than the diameter of typical freehubs, so the XD(R) drivers are shorter than the HG freehubs.
Because Shimano was not going in that direction at the time of SRAM's implementation of this standard (2015 or so)
Finally, to be different

SRAM explains that XDR is just the road version of XD. XDR bodies are 1.85mm longer than XD. I believe that MTB cassettes can mount to an XDR body with an additional spacer; Shimano actually does a similar thing because on the MTB cassettes, the biggest cog is cantilevered over the freehub body.
In general, most hubs will come with the option for Hyperglide (HG) or XD(R) bodies, and possibly Microspline, regular Campagnolo, or Campagnolo N3W freehub bodies. Yes, there are a lot of standards, and yes, Campy has two of them as well (N3W allows the cassettes associated with their 1x13 gravel groupset to mount). In any case, you would be able to change out the freehub if you buy a new one, provided you actually want to change your groupset. (If so, note that 11s road cassettes are interchangeable, and 12s road cassettes should be also.)
Basically, you will want the freehub/driver type that matches the groupset you are getting or that you have. If you have Shimano road, you want HG, keeping in mind that their road groups are expected to transition to microspline starting this year. If you have Shimano MTB, you want microspline. If you have SRAM, you want XD or XDR. On the off chance that you switch to Campagnolo, you'd probably want to get the N3W body if one is available; there's an adapter that allows you to run regular 9, 10, 11, or 12s Campy cassettes on the N3W hub.