Unification of gravity with other interactions, achieving the ultimate framework of quantum gravity, and fundamental problems in particle physics and cosmology motivate to consider extra spatial dimensions. The impact of these extra dimensions on the modified theories of gravity has attracted a lot of attention. One way to examine how extra dimensions affect the modified gravitational theories is to analytically investigate astrophysical phenomena, such as black hole shadows. In this study, we aim to investigate the behavior of the shadow shapes of higher-dimensional charged black hole solutions including asymptotically locally flat (ALF) and asymptotically locally AdS (ALAdS) in Einstein–Horndeski–Maxwell (EHM) gravitational theory. We utilize the Hamilton–Jacobi method to find photon orbits around these black holes as well as the Carter approach to formulate the geodesic equations. We examine how extra dimensions, negative cosmological constant, electric charge, and coupling constants of the EHM gravity affect the shadow size of the black hole. Then, we constrain these parameters by comparing the shadow radius of these black holes with the shadow size of M87* supermassive black hole captured by the Event Horizon Telescope (EHT) collaborations. We discover that generally the presence of extra dimensions within the EHM gravity results in reducing the shadow size of higher-dimensional ALF and ALAdS charged black holes, whereas the impact of electric charge on the shadow of these black holes is suppressible. Interestingly, we observe that decreasing the negative cosmological constant, i.e., increasing its absolute value, leads to increase the shadow size of the ALAdS charged higher-dimensional black hole in the EHM gravity. Surprisingly, based on the constraints from EHT observations, we discover that only the shadow size of the four dimensional ALF charged black hole lies in the confidence levels of EHT data, whereas owing to the presence of the negative cosmological constant, the shadow radius of the four, five, and seven dimensional ALAdS charged black holes lie within the EHT data confidence levels.