I have a question what is Ilm e Jafr. I heard some people have it. How do you achieve it?

What it is علم الجفر, is knowledge that has been taught from Prophet to Prophet of Prophecies and things to transpire. This was exclusively dictated to Imam Ali (as) by the Messenger of Allah (S).
This is different to what is commonly known today, ilm al jafr today is like Nostradamus or The Simpsons predicting the future. Every time something happens people will say it has already been mentioned in the jafr.
So no you can’t acquire it, don’t believe those that claim to know these things they are merely charlatans and will be exposed eventually.