Electric vehicles (EVs) can act as distributed energy storage units in smart grids through vehicle-to-grid (V2G) and grid-to-vehicle (G2V) operations. However, large-scale bidirectional EV charging introduces power quality issues, including harmonic distortion and DC-link voltage fluctuations. This paper presents a PSO-tuned modified dq (MDq) control strategy for a bidirectional EV charging system operating under V2G and G2V modes. A transformer-less bidirectional DC–DC converter and a grid-connected voltage source inverter with an LCL filter are modeled to enable controlled power exchange between the EV battery and the grid. Particle swarm optimization (PSO) is employed to optimally tune the controller gains using a multi-objective fitness function that minimizes grid current harmonics, DC-link voltage error, current ripple, and settling time. Simulation results obtained in MATLAB/Simulink demonstrate that the proposed MDq controller significantly outperforms conventional PI and MDq-PI controllers, achieving a grid current total harmonic distortion (THD) of 2.39% while maintaining stable DC-link voltage and fast dynamic response. The proposed approach enhances power quality, grid stability, and operational reliability, making it suitable for intelligent EV charging in smart grid applications.