I'll answer this from a British English perspective.
If you say 'the university', you're talking about one specific university in a specific location. As always when we use a definite article ( the ), the listener and the speaker both know WHICH university you're referring to. You might say, for example, "My boyfriend and I both study in Portsmouth. I go to the university and he's at engineering college.' When you say 'the university' here, you mean 'the university which is in Portsmouth'. Here's another example : "This flat is very convenient for the city centre, the airport and the university'. Here you are talking about the campus of the university in a particular location.
When you say 'I go to university' or 'I am at university', you're not specifying which university you're at: you're just telling us about your stage of education. 'I go to university' means 'I'm a university student' or 'I'm in higher education at the moment'. We know that you're studying for a degree.
Note that it's the same for other nouns. Compare 'I go to school' with 'I go to the school', 'She's in prison' with 'She's in the prison' or ( in British English) 'He's in hospital' with 'He's in the hospital'. In each case, the adverbial phrase without the article refers to your status, while the one with the article simply refers to a physical location.
And no, you wouldn't normally say 'I'm in the university' to mean that you're enrolled as a student at a university. We'd understand you, but it isn't quite right.
I hope that all makes sense.