40 percent could be a good grade depending on the class, it’s all relative in a class with a curve. Go to office hours and ask your professor for advice. He/she can actually see what you are doing wrong. See if your school has academic support services and use them.
Also do seek counseling/evaluation as others have suggested above.