I am in systems Phd program, but I want to do theoretical research
Of course you should give it a shot!  People switch fields all the time.  One of my most successful PhD students (in algorithms) started in my department as a systems PhD student.

Your first step should be to talk to faculty who do ML theory in your department, and ask them how to get involved, given your current background.  They might suggest classes to take for remediation; they might suggest specific papers to read/problems to work on that exploit your systems background; they might suggest first getting a master's degree (if you don't have one already) and then reapplying broadly to PhD programs.  If you are very very lucky, they may be willing to take you on as a student and offer you funding while you transition.

But one word of warning.  As I'm sure you already  know, competition for PhD admission in machine learning is incredibly fierce.  AI has always been the default subfield for smart CS students who want to go to grad school but really know what they want to do, but the popularity of machine learning has exploded over the last five years.  Last year, half of the almost 1000 applications for my CS department's PhD program listed AI/ML as their primary research area, and two-thirds listed AI/ML as a possible research area, even though only a small minority of our faculty work in that area.  (Of those roughly 500 applicants, we offered admission to about 50, and about 20 accepted our offer.)  This competition may make it harder for you to pursue a PhD in ML at your current institution.  That doesn't mean that moving to ML is impossible, but it may be difficult, and you may need to pursue multiple avenues to make it happen.

Best of luck!