BETHPAGE, N.Y., JULY 19 -- John O'Brien, the tough-talking executive who spent his entire career at Grumman Corp. and rose to become its chairman only two years ago, resigned abruptly today, citing ''personal reasons.''

The company's board of directors immediately replaced O'Brien with Renso L. Caporali, a Grumman vice chairman and longtime executive at the Bethpage-based aerospace giant.

The resignation of O'Brien, 60, who was president and chief executive officer as well as chairman, stunned many in the aerospace industry who thought he would lead the company well into the 1990s.

But O'Brien had become the subject of a federal investigation of influence peddling and political corruption among defense contractors, according to sources close to the probe, and a former Grumman board member said he was told today that the board had forced O'Brien out.

''Members of the board concluded that the problems involved were such that it was not in the interest of the company that he continue,'' said Orville L. Freeman, the former U.S. secretary of agriculture and governor of Minnesota who resigned from the Grumman board two months ago when he reached a mandatory retirement age of 72.

Freeman said that at the May board meeting, ''It had come to the attention of the board that there were inquiries {about O'Brien}. But no one knew how it would develop, so no action was taken.''

According to sources close to the investigation, O'Brien has not been charged and has not been called to appear before a grand jury in Uniondale, N.Y., probing the company. Sources said he is a subject, but not a target, of the federal investigation.

Company officials would not discuss the reasons for O'Brien's resignation.

Caporali, 57, will have the same three titles O'Brien had held since he succeeded John C. Bierwirth on Aug. 1, 1988. The board said that Caporali would hold the three posts ''while the board considers candidates for these positions."

O'Brien also resigned as a director, but ''will be available to help achieve an orderly transition,'' Grumman said in a statement. He was unavailable for comment. His resignation comes at a bad time for the company, which is trying to keep its airplane-building business healthy while it moves more heavily into the fields of electronics and space.

O'Brien is known to be a subject of an investigation connected with the long-running Department of Justice probe of Pentagon procurement practices. A former Grumman official, William Capaldo, pleaded guilty in May to accepting a $75,000 kickback as part of a bribery scheme that was allegedly masterminded by a now-deceased Long Island businessman, James Kane.