This paper delves into the transformative impact of machine learning (ML) on portfolio optimization, showcasing how ML algorithms can significantly enhance traditional financial models such as the Capital Asset Pricing Model (CAPM) and the Arbitrage Pricing Theory (APT). Through a comprehensive examination of regression analysis, classification algorithms, and reinforcement learning, we illustrate the methodologies by which ML refines the prediction of asset returns, assesses investment risks, and dynamically adjusts portfolio allocations. We discuss the integration of ML with CAPM and APT to improve the estimation of systematic risk and identify multi-factor influences on asset returns, offering a more nuanced approach to optimizing portfolios. Additionally, the paper highlights the role of big data in augmenting predictive accuracy and the application of optimization algorithms like Gradient Descent and Genetic Algorithms in achieving optimal asset allocations. By addressing challenges such as multicollinearity and overfitting, we demonstrate the potential of ML to revolutionize investment strategies, enabling more sophisticated risk management and return maximization. This study not only underscores the synergy between ML and traditional financial theories but also paves the way for future innovations in financial analytics.