Your book was rejected because it's awful.
Rejection is part and parcel of being a writer. It happens to everyone. It happens before you've sold your first manuscript and it continues to happen afterwards as well (unless of course you're J.K Rowling in which case people will pay to read your shopping list). It is, sadly, a fact of the writing life.
If you google writing and rejection you'll find lots of posts that try to explain it. It wasn't what the agent was looking for. They just bought a book very similar to yours and it's too much competition. You don't have a relative who works in publishing. Or a famous relative. Or relatives full stop. You don't have enough followers on Instagram. You subbed in a month with a Y in it. Then those posts will list lots of other books that were also rejected and went on to become world changing best sellers (back to J.K. again) and weren't those publishers stupid, they must be kicking themselves now, did you know Harry Potter was rejected FOURTEEN TIMES OMG. (Just as a brief aside, before I continue, I want to say something about the infamous 14 rejections, and what I want to say is this: 14 rejections is not very many.)
Whilst all of these reasons could be true in theory, they're not the reason that most books are rejected.
The reason that most manuscripts are rejected (and this could well include yours) is because they're awful. It's a bitter, humiliating pill to swallow, which is why people tie themselves in knots trying to find any other reason for their failure. It's why agents get abusive emails after sending rejections. It's what powers vanity publishing. It's also what has powered self-publishing. This isn't to say that all self-published books are terrible, but if you find yourself rushing your manuscript through Kindle Create in order to prove your genius to all those fuckwit editors who rejected it, it might be better to take a couple of days to think about it first.
So how do you know if your book is awful?
The rejections are your first clue. If you are consistently getting standard thanks but no thanks responses, or no responses at all, your book is awful. If you're getting personal feedback, even if it's just one sentence, then the book has something going for it. It needs work because a personal rejection is still a rejection but it doesn't stink quite as much.
All your family and friends love it. Of course they do. They have to live with you. They're not about to tell you that it was unreadable and they gave up on page 3, or that they didn't read it at all and just said they did so you would stop nagging them about it. They don't want to hurt your feelings. Unless they've got some connection to publishing or teach creative writing courses, their opinion is worthless.
It's your first draft of your first ever book.
It's your second draft but editing consisted of running spellcheck.
You have a feeling, deep down, that your book isn't the work of creative genius you want to believe it is. You don't want to examine that feeling too closely because you're fairly sure it would be like stubbing your toe on a concrete step. But it refuses to go away.
So what do you do?
The first step is to grieve for the awful book (if you google the five stages of grieving, you should be able to work out where you are with this). Hold a funeral for the manuscript that will never again see the light of day. Once you've done that, you need a plan. Maybe you decide to try and find a writing group, or take a course, or read a book on craft. Be proactive. Writing is a skill which means that you can learn how to do it better. If this all sounds too much like hard work (because it will be) then maybe writing isn't for you, not writing for publication anyway. Feel free to write for your own amusement, though. It doesn't matter how bad it is if that's the goal.
Where are you in your writing journey? Does your book stink? Share your stories of woe!