Whether you can "just sit in" on a university class depends on the class size and the professor's policy. In large "Intro to Psychology" style lectures held in auditoriums with 300+ students, a single extra person is unlikely to be noticed, and many people do this "unofficially" without issue. However, in smaller seminars, labs, or language classes where participation is required, your presence will be immediate and potentially disruptive. The professional and respectful way to handle this is through "Auditing." Most universities have a formal process where you can pay a reduced fee (or sometimes nothing) to attend a course without receiving credit. If you are a visitor, the best practice is to email the professor beforehand; many are happy to have an interested guest as long as there is an extra seat and the registered students have priority. Be aware that some institutions have strict security or "guest of the university" policies that forbid unauthorized individuals from being in academic buildings, so walking into a 15-person philosophy class without permission could lead to an awkward conversation with campus security.