Code golf is useless. It could be useful if it were about length of the generated assembly, but it's only about the code, which means is unreadable and unmaintainable.
Instead small assembler has utility because it uses less cache.
On other side, speed golf is the best thing.
It's a purely recreational activity. But there's a surprising amount of depth to it--the skill ceiling is extremely high and it's not uncommon for thought-to-be optimal solutions to be beaten years later. There's lots of crazy math and algorithm tricks you will never see in conventional programming. Getting good at code golf requires mastering not only the language, but lots of math and algorithmic skills as well.
Part of the fun is also doing things you're not supposed to do. Not only does it become unreadable, but you often are abusing dark corners of the language and implementation.
Speed golfing also often makes code unreadable and unmaintainable to some degrees. Everything is a trade-off.
It's about as useless as regular golf. The point is not to be useful, but as a fun competition and a demonstration of a niche skill.
For things that learn (humans, AI's-while-training), it's a useful exercise.
And things that play (humans), it's a useful diversion.
The sport gives you an incentive to learn a language, library, or algorithm more deeply and to discover new ways to think about how they work. It's very useful.