Reasonable option pricing is crucial in the financial derivatives market. Finding analytical solutions for the Black-Scholes (BS) equation, particularly for American options or with fluctuating volatility and interest rates, is challenging. BS equations exhibit strong time-series characteristics, with asset prices typically adhering to geometric Brownian motion. To address the BS equations, we propose a sequence-to-sequence model guided by physical information (PI), called PiMGA. The PiMGA fuses a multidirectional gated recurrent unit (GRU) network with an attention module, where multidirectional GRU enhances the coding performance of the input sequences and the attention module balances the feature weights of the hidden variables. Prior physical knowledge in BS equations is jointly used as a constraint, forming the penalty function for objective optimization. This allows PiMGA to serve as an efficient approximation function in the learning paradigm of physically informed machine learning to solve BS equations. BS equations with various complexities illustrate the accuracy and feasibility of PiMGA for numerical solutions. Furthermore, the out-of-distribution generalization ability of PiMGA is verified by predicting the Nasdaq 100 index.