Whatever the reasons, there are a number of ways in which you can make the most of a potentially wrong decision and still make the most out of your university experience.
If you are not liking your subject or are not being challenged, you can always speak to your tutors and negotiate changing to units which actually suit your interests, or if you were even more dissatisfied you could change your course altogether! If the latter, more extreme option sounds like more your cup of tea, then the key element if timing. If you register your request to transfer as early as possible, then you vastly improve your chances of actually getting to change. I have a friend who recently made the shift from studying maths to rebeginning the next year as a first year student again, and embarking on his preferred degree of philosophy. Universities are generally sympathetic to students struggling with their subject and will tend to be lenient so long as you demonstrate some initiative.
If changing unit or subject is not possible, then there are several things you can do to make sure that you at least make the very most of the degree you are doing. Studying a degree at university will very rarely be a backwards step in your life and if you remain receptive then you will be able to pick up skills which will still be relevant to your future, regardless of if you are enjoying yourself. Most degree courses incorporate elements which stimulate analytical, presentational, and persuasive skills which will be useful in whatever type of employment you may end up in. Along with the inherent skills graduates pick up at university such as learning how to meet new people, socialising amongst peers and learning to become more independent, university can always be a positive experience.
Another crucial technique to make the best of the wrong decision is to endeavour to make truly good friends, wherever you are. Finding like-minded people as yourself can turn a bad experience totally on its head. A key way of doing this at uni and finding real friends is by involving yourself in as many activities and university societies as possible. Unlike my aforementioned friend, I haven't studied any maths at university, but even I can see that the more people you meet, the more chances you give yourself to find good friends. If you create a social environment for yourself in which you are ultimately happy then it will become far easier for you to enjoy the rest of your university experience, in spite of the possible downsides.
Finally, while I rarely condone quitting, if you feel that your university just isn't for you, you ought to try and reapply to an alternative establishment where you might feel you could be happier. If this is the case, then make sure you don't repeat your previous mistakes and research the university and the specific course details thoroughly, before applying for the whole process over again.
While many students find cause for dissatisfaction at their respective universities, there are many ways in which they can work to make the best of their experience. One wrong decision does not have to dictate the tone of your whole university life and with the right attitude and amount of initiative, a bad situation can easily be resolved into a good one!