Q:

When should we work on GC optimization?

So, I've learnt about how GC works and how can I monitor it via VisualVM, but my question is about why we should ever perform GC optimization? In our web project (JSF/Spring/Hibernate) we haven't thought about this kind of optimization. Isn't it important and where such an optimization may be important?

A:

When your project experiences performance problems. 
You can fine tune the garbage collection algorithm used, how often to run it - depending on you performance requirements. Let's say you have lots of RAM on your server but not too much CPU power, then you want to delay garbage collector as much as possible to night time for example. And so on.

A:

(Disclaimer: I do not work on server-side backends, and I do not have any IT operational experience. My answer below is only from architectural theory and not from experience.)

If you are unsure of what to do, try the following order of precedence. (The first two steps has nothing to do with GC, but if those two aren't taken care of, talking about GC optimization is pointless.)
but please do not follow blindly; as I said I have no real experience in this.

First of all, you should find and eliminate memory leaks in your code base.
Next, you should identify wasteful usage of memory in your code base, and improve on that.
Then, you should learn the fundamentals of GC (which you have already accomplished).
Once you've learned it, you should start monitoring those vital statistics, in all environments - development, test, and production.
When those vital statistics indicate that your project could potentially suffer from a GC problem, use the techniques learned to isolate the cause, and/or apply one or more mitigations to keep the problem under control.

What are some of the things that could be tuned?
Just a few examples - pardon if my examples are wrong.

Tune the hardware (RAM sizes)
Tune the OS
Tune the JVM or GC
Tune your project in the way it uses (generating and maintaining) long-living objects, if such objects collectively account for a significant fraction of overall memory usage.

