Marshall Bruce Mathers III (born October 17, 1972), better known by his stage name Eminem (stylized as EMINƎM) and by his alter ego Slim Shady, is an American rapper , record producer , songwriter and actor .