It is definitively possible to do what you want, but your questions are samewhat problematic:
So, I need to know if it's possible to print that cylinder hard enough to work as an axis.
"hard enough" is a mysterious quantity. What is the intended application? The load of the axis, the rotation speed, the medium in which the part will be in, its operating temperature... they all affect the answer.
And what should be the gap size between the cylinder and the counter part's hole to rotate properly?
Reading at the question and the comments, I think you may have the wrong representation model in your mind. There are four different concepts at work here:
- Accuracy is the maximum dimensional variation between parts.
- Tolerance is the amount of random deviation or variation permitted for a given dimension.
- Allowance is a planned difference between a nominal or reference value and an exact value.
- Clearance is the intentional space between two parts.
So: what you want to achieve for the object to rotate is to have at least some clearance once you have the parts printed. Therefore, you want to design your part with an allowance which is at least as much as the accuracy.
Note that a machine cannot produce parts with a tighter tolerance than its accuracy. So you must design your part with a tolerance equal or greater than your printer accuracy.
The correct number will therefore be entirely dependant from the specific printer you will be using. You can find out the specific accuracy of a printer by printing a tolerance test (I know, I know... why isn't it called "accuracy test"?)
See this unrelated answer - from wich I took the above definitions - for learning more about the above and a concrete example.
If it's is like 0.05mm, can I print that level of detail with a 3D printer too?
I hope it is now clear why this question makes no sense: clearance is a variable which depends from accuracy (and the application), not the other way around.
I can't add so much gap because I have really limited space
This comment too is incorrect: the "gap" (clearance) can be very very small. You have to have the correct allowance in your design, and allowance will not intrinsically make a part larger.
What hardware and material should I use to do this?
Again: this is entirely dependent from your application (load, operating temperature, orientation, speed...)
A consumer-grade FDM printer (easy accessible, cheap and cheap to operate) will allow you to print a rotating part, a SLA/DLP printer (less common, toxic resins, more expensive to operate) will allow to print the same part with different materials and tighter tolerances...
I don't worry about breaking, but it cannot be flexible
Again: without an explanaton of the intended use (or the numbers associated to it) it's impossible to answer this comment conclusively. Resins tend to harden to more rigid solids, but you have thrown around tolerances as small as 0.05mm in your writing, and over 12mm of axis, that is a deviation of less than 0.5% from "perfectly straight". I'm hard pressed to think you will find a printable material with such a rigidity.