FBI directors serve at the pleasure of the president, but they often have terms that transcend partisan transfers of power at the White House. Firing an FBI director is a major problem from the point of view of a president who is already facing significant questions about investigations already underway.
It's generally not wise to pick a fight with law enforcement in politics, especially when you're in the middle of a pretty significant scandal already.
The one thing you never want to do in politics is take the hit for someone else's misconduct - especially someone as erratic as President Trump.
Firing someone who is investigating you is a counterproductive strategy.
Presidents are given immense power in the American political system when it comes to personnel. FBI directors are given ten-year terms to insulate them from politics as much as one can, but it's not absolute protection. If a president wants to fire an FBI director, they can do that.