Why is the nucleus in the center of a cell?

It is not always in the center of the cell. No more than if the endoplasmic reticulum is found there. In some cell types it is found toward the edge. It may be due to what is actually in the cell.