Prosecutors accused a Beverly man of using his position as a top official at Keolis Commuter Services, which operates the MBTA commuter rail system, to defraud the company of millions of dollars meant for repairs and maintenance in a years-long scheme alongside his personal friend.