Typhoon Megi (2016) headed northwestward toward Taiwan with southward deflection near landfall. In this study, Hurricane Weather Research and Forecast system (HWRF) was used to investigate the mechanism of the track changes over free ocean and track deflection near landfall. HWRF simulations using more realistic Hybrid Coordinate Ocean Model sea surface temperature (SST) analysis improve the northward biased track compared with that using Global Forecast System SST, due to the initial cooler SST below the storm path. The initial warmer Global Forecast System SST leads to a northward track shifting with an overintensified typhoon. As the Princeton Ocean Model is coupled, the SST over South China Sea becomes warmer leading to a northward track shifting compared to a southward shifting induced by the upper ocean cooling due to the typhoon-ocean interactions in the vicinity of the typhoon. Regardless of track shifting, southward deflection near landfall is mainly controlled by orographic effects of the Central Mountain Range (CMR). Cyclonic northerly is enhanced to the west of the typhoon center ahead and over the CMR that results in southward deflection. Diagnostics of potential vorticity (PV) tendency budget indicates that southward deflection can be explained by the southeastward tendency of latent heating effects near landfall. The combined effects of latent heating and cyclonic rotation of positive wave numer-1 (WN-1) potential vorticity vertical advection dominate the southward deflection when the typhoon is closer to Taiwan. Furthermore, the typhoon movement near landfall is slowed down mainly due to WN-1 negative vertical differential latent heating over the northern CMR.