I admire your strength of character in admitting your ambivalent and unhappy feelings. Don’t panic. Every year undergraduates just like you think they have may have made a big mistake in the subject of their degree – or in even going to university at all. They are often among the most successful in their final university degrees and subsequent careers.
If you have not already done so by the time you read this, please seek out the university person who is your designated personal tutor or academic supervisor. He or she will be keen to help and have guided students through crises similar to your own.