How to use nodal or mesh analysis with a current source?
My problem here is how current source works.

The beauty of source transformation
If I redrew your original circuit like this: -

Would you find it easier to solve?
Would you know what to do next to simplify it even further?
The redrawn circuit that splits the current source into two current sources is generally using a technique called &quot;source transformation&quot;. So, you use source transformation to make it easier to simplify other parts of the circuit and then keep drilling down until it's really very simple and obvious.
The next step
For instance the next step (as I see it) is to convert the 6 volt source and its associated 3 kΩ resistor into a 2 mA current source in parallel with 3 kΩ and, that new current source is in parallel with the 4 mA source that got split due to source transformation. The 3 kΩ is in parallel with the 6 kΩ and so, you have a combined current source of 4 mA - 2 mA (pointing down) in parallel with a combined resistor of 2 kΩ: -


This circuit can then be converted to a -4 volt voltage source in series with 2 kΩ and the circuit is halfway simplified and the resulting position of the new 2 kΩ is directly and unambiguously in series with the horizontal 4 kΩ resistor. See below for the conversion and simultaneously, I changed the other current source and it's 2 kΩ resistor to a series voltage source: -

How simple does it look now and how much more simplification can be done? Convert both the voltage sources and their total series resistances (6 kΩ and 10 kΩ) to current sources in parallel with their total series resistances and bingo you are just about done.
Then combine current sources into one current source and combine all the parallel resistors into one resistor and you get the thevenin voltage and the thevenin resistance.
Of course if you want to use math...
Then that's up to you but you won't really learn much about how to look at a circuit and simplify it and that, is more important than blindly applying math. Of course, there are occasions when you cannot proceed without math/algebra but, not on this occasion.