Never move physics objects by manipulating transform.position
direction.
The reason is that by doing so you are bypassing and short-circuiting the physics engine, giving it no chance to act.
Instead, use a reference to your Rigidbody2D and this property and method:
By reading from .position
, making your pos.x = speed;
change, then calling MovePosition(pos)
, you are informing the physics engine of your intentions, which should allow gravity to function as you desire.
Also, if you post a code snippet, please use code tags:
How to use code tags: Using code tags properly