We carry out the first time-dependent numerical magnetohydrodynamic modeling of an extrasolar planetary system to study the interaction of the stellar magnetic field and wind with the planetary magnetosphere and outflow. We base our model on the parameters of the HD 189733 system, which harbors a close-in giant planet. Our simulation reveals a highly structured stellar corona characterized by sectors with different plasma properties. The star-planet interaction (SPI) varies in magnitude and complexity, depending on the planetary phase, planetary magnetic field strength, and the relative orientation of the stellar and planetary fields. It also reveals a long, comet-like tail which is a result of the wrapping of the planetary magnetospheric tail by its fast orbital motion. A reconnection event occurs at a specific orbital phase, causing mass loss from the planetary magnetosphere that can generate a hot spot on the stellar surface. The simulation also shows that the system has sufficient energy to produce hot spots observed in Ca II lines in giant planet hosting stars. However, the short duration of the reconnection event suggests that such SPI cannot be observed persistently.