Don't act yet.
There's no need to ask yet. You aren't enrolled at the university, so there's no need to ask. If you must ask, then ask an administrator, rather than the professor. (Professors are busy, they'd rather have fewer emails.) Assuming you're accepted, then you have several options.
Exception: You should ask if your decision to enrol depends on the answer. (See comments for further discussion.)
Just turn up.
You can sit at the back of the class and ask the professor afterwards, e.g., Hi, I sat-in on your course today and I really enjoyed it. I'm not formally registered, but I'd like to continue attending, is that okay? You can answer any follow-up questions in person. For large classes, this approach is fine. For smaller classes (or tutorials, lab sessions, etc.), you might want to ask in advance.
You needn't ask: Attending an occasional class on which you aren't registered is fine, but it is courteous to ask. (See also Allowing a student to sit in during class.)
Ask in advance.
You can attend the professor's office hours and ask something along the lines of, e.g., Hi, I'm studying ..., but I'd like to attend your class ..., is that okay? Again, you can answer any follow-up questions in person. The same question can be asked by email.
What's better?
It really depends on the professor. Personally, I'd favour a student just turning up to my class. It requires the minimal effort on my part.