I am 401 pounds. I am trying to lose weight. How long should I exercise. And how much water should drink? And how much calories should I be eating a day?

Do nothing, to start. A 400 pounder is morbid and dangerously obesity. Genetics, emotional trauma usually when young, and a fat encouraging culture are among he causes. The disease affects heart, glandular, musculoskeletal and othe organs. Adversely affect the glandular system, heart, musculoskeletal and other organs. U need a comprehensive medically supervised program. (500 calories less per day = 1 lb wt loss/wk).
That is difficult. Doing this on your own although noble will likely fail. But to start walk 20 minutes per day and decrease your daily caloric intake by 500kcal for every one pound per week you want to lose. Drink 64 oz of water per day. Good luck. Also, read about the low glycemic diet.