Three-dimensional (3D) natural convection (NC) processes in heterogeneous porous media and associated energy losses and mixing processes are still poorly understood. Studies are limited to two-dimensional domains because of computational burden, worsened by heterogeneity, which may demand grid refinement at high permeability zones for accurate evaluation of buoyancy forces. We develop a meshless Fourier series (FS) solution of the natural convection problem in a porous enclosure driven by thermal or compositional variations. We derive the vector potential formulation of the governing equations for vertical and horizontal heterogeneity of hydraulic conductivity and implement an efficient method to solve the spectral system with an optimized number of Fourier modes. 3D effects are induced either by heterogeneity or variable boundary conditions. The developed FS solution is verified against a finite element solution obtained using COMSOL Multiphysics. We evaluate entropy generation (viscous dissipation and mixing) indicators using FS expansions and assess how they are affected by heterogeneity. We define a large-scale Rayleigh number to account for heterogeneity by adopting an arithmetic average effective permeability. The FS solution is used to investigate the effect of the large-scale Rayleigh number and level of heterogeneity on NC processes and energy losses. Results show that increasing the Rayleigh number intensifies fluid flow, thus enhancing convective transfer, which causes a dramatic increase in total entropy generation. Both viscous dissipation and mixing (and thus chemical reactions in the solute transport case) increase. The third dimension effect, which also enhances flow and entropy indicators, is more pronounced at high Rayleigh numbers. Surprisingly, entropy variation indicators remain virtually unchanged in response to changes in heterogeneity, for fixed Rayleigh number, which we attribute to the arithmetic average permeability being indeed appropriate for NC in 3D. This study not only explores the effect of Rayleigh number and heterogeneity on natural convection processes and the associated entropy generation and mixing processes, but also provides a highly accurate solution that can be used for codes benchmarking.