You can. First you need to buy the new ship. Then you look at the left of your screen, where the ships in the fleet are displayed. Select your new ship from that panel. On the left side there is a small button with some chevrons (like 3 little arrows that look upward). Click that button in order to promote that ship to flagship. Sadly there is no way to simply swap the old ship for a new one. If you want to do it, you have to do as I said and then destroy your old flasghip. Hope this changes soon.