Any liquiid-fluid works for grip installation. The liquid temporarily decreases the surface friction between the grip and the bar, and then departs.
Personally I use soapy water which evaporates over time, leaving the slightly tacky soap behind to discourage twist in the grip.
WD40 has some mild petroleum products in it which may damage some rubber compounds. I've never seen that myself, but I don't spray WD40 on grips either. This might subtly texture the underside of the grip at a microscopic level (this is a guess)
WD40's lighter components would flash off over some hours, leaving behind the waxier protectant layer which acts as a weak glue, same as the soap I use.
My other tool for removing grips is a very long thin flathead screwdriver. Poking it in at the end between bar and grip allows a channel for the fluid to move along the length of the grip, where it dissolves the residue from installation. and some sharp twists makes the grip loose all the way around.