After being a huge part of the first two live-action Transformers movies, many fans were left wondering why Megan Fox left the Transformers franchise before Transformers: Dark of the Moon. With Steven Spielberg producing, Paramount launched a live-action Transformers franchise in 2007. Michael Bay directed Shia LaBeouf as Sam Witwicky and Fox as Mikaela Banes in the first movie. It was a huge hit financially, earning over $709 million worldwide (via Box Office Mojo). Transformers: Revenge of the Fallen did even better in 2009, guaranteeing a trilogy. However, the Megan Fox Transformers issue left a dark cloud over the franchise.
https://screenrant.com/transformers-dark-moon-megan-fox-exit-fired-explained/