2 reasons are usually taken when explaining why Napoleon sold Louisiana to the US.
1) He failed to reclaim Santo Domingo due to numerous reasons. Without Santo Domingo, he didn't need Louisiana, as Louisiana was supposed to be a granary for Santo Domingo.
2) He was afraid he would have to give it to Britain for free. To stop this, he sold it to the United States hoping they would become as strong and large as Britain.