Usually, in a case like this, locus of control is everything. To be real i'll have to say it is very easy to be in spectator mode and accept things are just the way they are, but it's best to take responsiblity and accept that it's your fault things are like this.
Though this seems tough to swallow, this also means that you are in control of what happens. I understand how hard it may seem, but this could mean maybe you're not confident enough to start the relationships yourself or someone that people want to be around. You can change this, grow confidence by figuring out a passion, this can even be a short term goal. Get into any type of fitness every single day, make your body look better, you'll feel better too. Ask for advice on information gaps with the gym for example. make sure you are consistent with this. It will give you a small passion which is important.
Learn social skills, this is something they don't teach as a subject but it will definitely change your life, have a large circle be it for friendship or something more is all something you can learn. RSD (real social dynamics) on youtube is a great place to start. This is perfect as it's something you can learn in your own time, by yourself in the comfort of your own home but take it seriously. You imrpove these skills you'll have great friendships and lovers.
Another thing that is very good to do is take up new hobbies. At university it is so easy to do this, join the drama society, football, hiking, the society of your choice and you'll have more opportunity to practise your new found social skills and discipline to fitness.
Finally, Add to all this forcing your change in your own thought. Self-talk is the voice in our head, we can control what we tell ourselves, as hard as it may seem, commit to telling yourself positive things, even though you don' believe it for a week. Learn about good posture, learn about how to increase your natural energy levels, take care of your hygeine and aesthetics and remember!
You don't have time to be depressed if you are taking huge amounts of action. Try and pack your timetable as much as you can, whatever it is no matter how simple the tasks may be.
I'll finish on this note. People are friends with people who bring value to them. Say 'Hi', and smile to random people, it will be so hard the first time, but it'll get easier, you have no idea what doors this can open. And also, a positive person is value to the people around them. If you can force yourself into becoming a more positive person, people will be DRAWN into you.
All of this helped me and many others in my situation. If you commit to this and take all this seriously, You will become a better person.
Good Luck, You got this!