In this paper, the aluminum nanofoam compression and shear deformation behavior are investigated using molecular dynamics (MD) simulations with emphasis on the dislocation-based underlying mechanism and temperature dependence. Nanofoam structures with controlled relative density are generated by Voronoi tessellation and simulated quasi-statically using the embedded-atom method (EAM) potential. The simulations determine distinct deformation behaviors: Compression has three consecutive stages—elastic response, plastic plateau via ligament buckling, and densification—and shear deformation has initial linear elasticity followed by nonlinear hardening and localized shear banding. Size effects at the nanoscale significantly enhance the yield strength, with compressive strength higher than shear strength by approximately 30–40%. Power-law scaling of stiffness and yield stress with relative density is confirmed, as predicted by Gibson–Ashby. Dislocation analysis indicates that plasticity begins by Shockley partial dislocation nucleation at pore walls, growing dense dislocation networks under compression but developing toward a steady state under shear due to efficient dislocation annihilation at free surfaces. Elevated relative density enhances the material’s strength and hardness and reduces ductility, whereas elevated temperature lowers strength and stiffness significantly due to thermally activated dislocation motion. These observations represent atomistic visions of structure–property relationships in aluminum nanofoams and offer design hints for optimizing strength–ductility balance in weight-efficient structural applications.