From the Super Mario Wiki, the Mario encyclopedia
A gravity field is a special type of wall that appears in Super Mario Galaxy and Super Mario Galaxy 2. It has the power to control the direction that gravity pulls Mario within its expanse. The gravity fields contain arrows to show the player the gravity direction, as well colors: blue (arrows pointing down), red (or occasionally pink; arrows pointing up), green (arrows pointing the right), gray, and purple (in Super Mario Galaxy and Super Mario Galaxy 2, respectively, arrows pointing to the left). As soon as Mario or Luigi enters the area with the painted arrows and colored background, either character is immediately pulled towards the object that the arrows are pointing to. The direction that the arrows are pointing on the wall (and therefore the direction of gravity itself) can sometimes be changed if the player finds a Gravity Arrow and Spins it or hits it with a Star Bit. Gravity fields appear in many levels, the most prominent of which is Bowser's Dark Matter Plant, where they act as the main obstacle of the level. The Rightside Down Galaxy and the Upside Dizzy Galaxy feature gravity fields as their main elements. Gravity fields appear only in 2D sidescroller sections of Super Mario Galaxy and Super Mario Galaxy 2, however.
Gravity field areas
Super Mario Galaxy
Super Mario Galaxy 2