I would advise you to definitely speak to someone on campus about this. All universities have mental health advisers who are normally great... they are completely nonjudgmental and they have a lot of experience with new students who are struggling with various things. There should also be someone in your student dorms (normally a postgrad student who acts as a tutor) that lives close by and has an open door policy for this sort of thing... they are there to help you and they are happy to help... whether it's a chat, a cup of tea, ideas for how to make your time more enjoyable, how to manage your studies etc. They are a good resource to tap into because they have the time, willingness, and experience to help you.
Yes, university accommodation can be gross, especially if you are sharing bathroom facilities. However, they will be cleaned regularly and you can speak to the halls manager if there are any serious issues. Can I advise that you decorate your room as colorfully and cosy as possible... it will make the room seem a lot more pleasant and help to create a relaxed environment for you to come back to after a long and/or stressful day.
I aso struggled with some of my modules and I got stressed out regularly so I made a promise to myself to only study outside of my bedroom (in the library, in a cafe etc so that my room would remain a calm haven and I wouldn't feel guilty at the end of the day when I went to bed... "I'm in my room in bed, I can't study here, so I can fall asleep without guilt!"
It does take time to make friendships, especially close friendships. I have several acquaintances during my first term as an undergraduate but it wasn't until the 2nd semester that I made real friendships. It was tough but then once I found 'my people' everything changed and I became a lot happier and comfortable. I graduated form university in 2014 and I am still in touch and best friends with my friends from university - they're like my family.