Colors > Map > Gradient Map works exactly the same in recent versions of GIMP as it did in older versions.
Make sure your image has a range of tones - from black to grey midtones, and bright highlights. A gradient map can only work properly on an image that has a good range of tones. It wont work well if all your brush strokes are 100% opacity. Also note that everything including the black background needs to be on one layer.
Here's an example (current stable release GIMP 2.10.22). I reduced the brush opacity to about 30%, then painted with different random brushes repeatedly. Then I did a final Levels adjustment to make sure it had a full range of tones.
Here's the levels adjustment I applied, to add more contrast, and below it I've shown the before and after.


Here's the before and after, using the "Incandescent" gradient for the gradient map.
