Melt butter in a saucepan over medium-high heat. Saute onion and garlic in hot butter until tender, about 5 minutes. Stir cream cheese with the onion mixture until melted and smooth; add corn and jalapeno pepper. Season the mixture with salt and black pepper; pour into a casserole dish.
Bake until beginning to brown around edges, about 35 minutes.