It is never too old to transition and 36 is not old. Have a growth mindset. Don't listen to anyone who says it is too old to switch. You have one life to live, do what makes you happy.
Here is one advice, check that you want to move to AI/ML for the right reasons, not because it is the next cool thing.
One strategy: Take some of the courses in ML, for example Andrew Ng's course on ML and Deep learning. If you enjoy the course, next find a real project to do and see if you truly enjoy it. If you do enjoy it then switch, otherwise Java programming is always there. I have found real ML is a lot different from Andrew Ng's course for example, pretty much like doing algorithms in class is different from real world programming.